[R] ggplot2: can one have separate ylim for each facet?
Etches Jacob
jacob.etches at utoronto.ca
Mon Nov 17 22:49:26 CET 2008
In lattice
#toy data
library(ggplot2)
library(lattice)
x <- rnorm(100)
y <- rnorm(100)
k <- sample(c("Weak","Strong"),100,replace=T)
j <- sample(c("Tall","Short"),100,replace=T)
w <- data.frame(x,y,j,k)
xyplot(y~x|j+k,scales=list(y=list(relation="free")))
will give you a scale in each subplot with a range equal to the range
of y within each subplot.
Is this possible using ggplot2?
qplot(x,y,data=w) + facet_grid(j~k) + ylim(-2,2)
produces a plot with the same range in each subplot. Can the lattice
behaviour be reproduced in ggplot2?
Thanks,
Jacob Etches
More information about the R-help
mailing list