[R] lattice multiple y-scale possible?

Steven R Corsi srcorsi at usgs.gov
Tue Jun 28 16:03:06 CEST 2011


Dennis

Adding in y = list(relation = 'free') to the scales argument worked  
very well.

Thanks!
Steve

===============================================
Steven R. Corsi        Phone: (608) 821-3835
Research Hydrologist   email: srcorsi at usgs.gov
U.S. Geological Survey
Wisconsin Water Science Center
8505 Research Way
Middleton, WI 53562
===============================================


On 6/28/2011 6:23 AM, Dennis Murphy wrote:
> 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