An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110517/8d812f8f/attachment.pl>
scales argument in bwplot (lattice)
4 messages · Doran, Harold, Peter Ehlers, Duncan Mackay
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.
1 day later
Hi Peter A little late but catching up see ? combineLimits from the latticeExtra package a very welcome addition in particular when combined with useOuterStrips with multiple conditioning Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email: home mackay at northnet.com.au
At 01:29 18/05/2011, you wrote:
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.
______________________________________________ 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.
1 day later
On 2011-05-18 17:50, Duncan Mackay wrote:
Hi Peter A little late but catching up see ? combineLimits from the latticeExtra package a very welcome addition in particular when combined with useOuterStrips with multiple conditioning
I agree that latticeExtra has some very nice goodies, but in this case I don't think that combineLimits answers Harold's request. Peter Ehlers
Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email: home mackay at northnet.com.au At 01:29 18/05/2011, you wrote:
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.
______________________________________________ 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.
______________________________________________ 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.