On 2011-05-17 06:50, Doran, Harold wrote:> Suppose I have data such as the following
>
> set.seed(12345)
> tmp<- data.frame(var1 = rnorm(100), var2 = rnorm(100), var3=rnorm(100,
10, 30))
>
> tmp1<- data.frame(vars = with(tmp, c(var1, var2, var3)), type = gl(3,
100))
>
> var3 is on a different scale, but I create the following plot, which looks
terrible as a result
>
> bwplot(~ vars|type, tmp1,
> layout = c(1,3),
> )
>
> Of course, I can use the scales = 'free' argument and this looks
fine.
>
> bwplot(~ vars|type, tmp1,
> scales = 'free',
> layout = c(1,3),
> )
>
> My real world data are a little tougher to describe, but follow
> a similar pattern. My question is, is there a way to make the
> bottom two boxplots to have the *same* scale, but for the top
> plot to have its own unique scale?>
> The scales = 'free' argument permits for each plot to have its
> own scale. Perhaps there is a way to generalize this so only
> certain plots have a unique scale and all others are on the
> same scale.
Does this help:
bwplot(~ vars|type, layout = c(1,3), data=tmp1
, scales = 'free'
, xlim=list(c(-3,3), c(-3,3), c(-60,90))
)
There's a comment on ?xyplot in the scales section:
"When relation is "free", xlim or ylim can be a list, ..."
Peter Ehlers
>
> Thanks
>
> Harold
>
>
>> sessionInfo()
> R version 2.12.0 (2010-10-15)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252 LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C LC_TIME=English_United
States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] lattice_0.19-13
>
> loaded via a namespace (and not attached):
> [1] grid_2.12.0 tools_2.12.0
>
> -
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.