[R] lattice multiple y-scale possible?

Dennis Murphy djmuser at gmail.com
Tue Jun 28 13:23:01 CEST 2011


Hi:

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), rot = c(0, 90),
                 y = list(relation = 'free')))

Does that work?

Dennis

On Mon, Jun 27, 2011 at 10:46 PM, Steve Corsi <srcorsi at usgs.gov> wrote:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list