12.6 Parallel Coordinates Plot

# Fig. 12.9: Parallel coordinate plot
library(StatDA)
data(chorizon)
el=sort(c("Na","Sr","Ca","La","Y","Ti","Zn","Cu","Pb","Th","Ba","K"))
x=chorizon[,el]
sel=((chorizon[,"LITO"]==7) |
(chorizon[,"LITO"]==9) | (chorizon[,"LITO"]==82))
grp=chorizon[sel,"LITO"]
grp[grp==7] <- 0.4
grp[grp==9] <- 0.7
grp[grp==82] <- 0
x=scale(log10(x[sel,]))



# true representation of x and y axis of map for plot

pdf("fig-12-9.pdf",width=8,height=4)
par(mfrow=c(1,1),mar=c(3,1,1,1))
parcoord(x,col=gray(grp),lwd=1.3-grp,cex.lab=1.2,ylim=c(0,1.2))
legend("topright",lty=1,lwd=1.3-c(0.7,0,0.4),col=gray(c(0.7,0,0.4)),bty="n",
legend=c("Caledonian sediments","Alkaline rocks","Granites"),ncol=3)

dev.off()