3.7 Combination of Histogram, Boxplot or Box-and-Whisker Plot,

# Fig. 3.18: Summary of Bob for Ba in C-horizon
library(StatDA)
data(chorizon)
Ba=chorizon[,"Ba"]
n=length(Ba)

pdf("fig-3-18.pdf",width=8,height=7)
par(mfcol=c(2,2),mar=c(4,4,4,2))

###################
hist(Ba,25,main="",xlab="Ba in C-horizon [mg/kg]",ylab="Frequency",cex.lab=1.2)
title("Histogram")

###################
plot(sort(Ba),((1:n)-0.5)/n,pch=3,cex=0.8,
main="",xlab="Ba [mg/kg]",ylab="Probability",cex.lab=1,cex.lab=1.2)
abline(h=seq(0,1,by=0.1),lty=3,col=gray(0.5))
abline(v=seq(0,1200,by=200),lty=3,col=gray(0.5))
title("ECDF-plot")

###################
boxplot(Ba,horizontal=T,xlab="Ba [mg/kg]",cex.lab=1.2,pch=3,cex=1.5)
title("Tukey boxplot")

###################
qpplot.das(Ba,qdist=qnorm,xlab="Ba [mg/kg]",
ylab="Probabilities of standard normal distribution", pch=3,cex=0.7, logx=FALSE,cex.lab=1.2)
title("CP-plot")
###################

# Fig. 3.19: Summary of Bob for log10(Ba) in C-horizon
library(StatDA)
data(chorizon)
Ba=chorizon[,"Ba"]
n=length(Ba)

pdf("fig-3-19.pdf",width=8,height=7)
par(mfcol=c(2,2),mar=c(4,4,4,2))

###################
hist(log10(Ba),25,main="",xlab="Ba in C-horizon [mg/kg]",ylab="Frequency",cex.lab=1.2,
xaxt="n")
axis(1,at=log10(alog<-sort(c((10^(-50:50))%*%t(c(5,10))))),labels=alog)
title("Histogram")

###################
plot(sort(log10(Ba)),((1:n)-0.5)/n,pch=3,cex=0.8,xaxt="n",
main="",xlab="Ba [mg/kg]",ylab="Probability",cex.lab=1.2)
axis(1,at=log10(alog<-sort(c((10^(-50:50))%*%t(c(2,5,10))))),labels=alog)
abline(h=seq(0,1,by=0.1),lty=3,col=gray(0.5))
abline(v=log10(alog),lty=3,col=gray(0.5))
title("ECDF-plot")

###################
boxplot(log10(Ba),horizontal=T,xlab="Ba [mg/kg]",cex.lab=1.2,pch=3,xaxt="n")
axis(1,at=log10(a<-sort(c((10^(-50:50))%*%t(c(2,5,10))))),labels=a,cex=1.5)
title("Tukey boxplot")

###################
qpplot.das(log10(Ba),qdist=qnorm,xlab="Ba [mg/kg]",
ylab="Probabilities of standard normal distribution", pch=3,cex=0.7, logx=TRUE,cex.lab=1.2,
logfinetick=c(2,5,10),logfinelab=c(2,5,10))
title("CP-plot")
###################

dev.off()