[R] lattice multiple y-scale possible?
Steve Corsi
srcorsi at usgs.gov
Tue Jun 28 07:46:47 CEST 2011
Hi
I am attempting to use the lattice bwplot function to generate boxplots
of numerous parameters (1-panel/parameter) by site (x-axis). The
parameters have quite different ranges of values, so it would be best to
have a separate y-axis range for each panel. Below is a basic example of
what I am trying to do. As is seen, the y-axes need to be scaled
individually to make this useful. Any information on how to do this
would be much appreciated:
rm(mydat)
rm(tempdf)
for (i in 1:5){
for (ii in 1:5){
dat <- sample(1:20)*10^ii
tempdf <- data.frame(dat)
tempdf$parameter <- paste("parameter ",ii,sep="")
tempdf$site <- paste("site",i,sep="")
if(!exists("mydat")) {mydat <- tempdf
}else {mydat <- rbind(mydat,tempdf)}
}
}
bwplot(dat~site|parameter,data=mydat,
layout=c(1,5),
cex=2,
xlab="Site Name",
ylab="",
labels=levels(mydat$site), scales=list(tick.number=list(4)))
thanks
Steve
More information about the R-help
mailing list