setwd('/users/daf/Current/courses/Probcourse/HigherDimensions/RCode') library('lattice') # work with iris dataset this is famous, and included in R # there are three species head(iris) # shows some info levels(iris$Species) #shows the species names colr<-c('red', 'green', 'blue') ss<-expand.grid(species=1:3) pchr<-c(3, 4, 0) parset<-with(ss, simpleTheme(pch=pchr[species], col=colr[species])) speciesnames<-c('setosa','versicolor', 'virginica') setEPS() postscript("irisscatterplot.eps") splom(iris[, c(1:4)], groups=iris$Species, col=colr[ss$species], par.settings=parset, varnames=c('Sepal\nLength', 'Sepal\nWidth', 'Petal\nLength', 'Petal\nWidth'), key=list(text=list(speciesnames), points=list(pch=pchr), columns=3)) dev.off() # very nice figure ?how does one title a splom? setEPS() postscript("iriscloud.eps") cloud(Petal.Length~Sepal.Length+Petal.Width, data=iris, pch=pchr, groups=Species, par.settings=simpleTheme(pch=c(3, 4, 0)), auto.key=list(space='top', columns=3, between=1, text=speciesnames, between.columns=2)) dev.off()