Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Views: 238
Kernel: R (R-Project)
require(ggplot2) p1 <- ggplot(mpg, aes(x=class, y=hwy)) + geom_boxplot(color="blue", fill="blue", alpha=0.2, notch=TRUE, notchwidth = 0.8, outlier.colour="red", outlier.fill="red", outlier.size=3 ) p1
Loading required package: ggplot2 notch went outside hinges. Try setting notch=FALSE. notch went outside hinges. Try setting notch=FALSE.
Image in a Jupyter notebook

… saving plot to PDF

pdf("r-cars-plot.pdf") p1 dev.off()
notch went outside hinges. Try setting notch=FALSE. notch went outside hinges. Try setting notch=FALSE.
png: 2
require("fishmethods")
Loading required package: fishmethods Loading required package: MASS Loading required package: boot Loading required package: bootstrap Loading required package: lme4 Loading required package: Matrix Loading required package: numDeriv
data(rig) fit <- grotagplus(rig,dataID="Sex",alpha=70,beta=100, model=list(mean="Francis",var="linear",seas="none"), design=list(galpha=list("F","M"),gbeta=list("F","M"), s=1,nu=1,m=0,p=0), stvalue=list(galpha=c(5,4),gbeta=c(3,2),s=2,nu=0.5), upper=list(galpha=c(8,6),gbeta=c(5,4),s=4,nu=1), lower=list(galpha=c(3,2),gbeta=c(1.5,1),s=0.5,nu=0.2)) mnlenatage <- list(F=90.7*(1-exp(-0.42*(seq(1.5,6.5)-0.77))), M= 118.7*(1-exp(-0.16*(seq(4,11)-2.02))), PGM=161.1*(1-exp(-0.11*(seq(3.5,10.5)-1.91)))) plot(fit,age.based.growth=mnlenatage) ## Residual plots fit <- grotagplus(rig,dataID="Sex",alpha=70,beta=100, model=list(mean="Francis",var="linear",seas="none"), design=list(galpha=list("F","M"),gbeta=list("F","M"), s=1,nu=1,m=0,p=0), stvalue=list(galpha=c(5,4),gbeta=c(3,2),s=2,nu=0.5), upper=list(galpha=c(8,6),gbeta=c(5,4),s=4,nu=1), lower=list(galpha=c(3,2),gbeta=c(1.5,1),s=0.5,nu=0.2)) plot(fit,"resid") plot(fit,"resid",resid.spec=list(Pearson=FALSE,x="L1")) ## Trajectory plot as in Fig. 2 of Francis (1988) data(bonito) fit <- grotagplus(bonito,alpha=35,beta=55, design=list(galpha=1,gbeta=1,s=1,nu=1,m=1,p=1,u=1,w=1), stvalue=list(s=0.81,nu=0.3,m=0,p=0.01,u=0.5,w=0.5), upper=list(s=3,nu=1,m=2,p=0.1,u=1,w=1), lower=list(s=0.1,nu=0.1,m=-2,p=0,u=0,w=0)) plot(fit,"traj",Linitial=35)
Image in a Jupyter notebookImage in a Jupyter notebookImage in a Jupyter notebookImage in a Jupyter notebook

3D plot package

library("plot3D") with(USArrests, text3D(Murder, Assault, Rape, labels = rownames(USArrests), colvar = UrbanPop, col = gg.col(100), theta = 60, phi = 20, xlab = "Murder", ylab = "Assault", zlab = "Rape", main = "USA arrests", cex = 0.5, bty = "g", ticktype = "detailed", d = 3, clab = c("Urban","Pop"), adj = 0.5, font = 2)) # Add points with(USArrests, scatter3D(Murder, Assault, Rape - 1, colvar = UrbanPop, col = gg.col(100), type = "h", pch = ".", add = TRUE))
Image in a Jupyter notebook