Re: [R] Setting scales for ggplot2 with facets

2011-06-24 Thread Tom Hiatt
Hi Sven, Not sure if you're still having this problem, but I was as well and googled into your post. I didn't find a great answer either, but the workaround I'm using is some dummy points or lines with alpha=0 so they don't show up (ie geom_hline(yintercept=0, alpha=0)). I suppose the same could

Re: [R] Setting scales for ggplot2 with facets

2010-09-12 Thread Sven Laur
Sorry, I was too vague in my initial question. To make it clearer I included the following example: tmp - data.frame(y=runif(10), x=gl(2,5), class=gl(2,5)) p - ggplot(data = tmp) p - p + geom_point(aes(y=y, x=x)) p - p + facet_wrap(~ class, scales = free) p - p + ylim(0, 1) p This code draws

[R] Setting scales for ggplot2 with facets

2010-09-11 Thread Sven Laur
Faceting in ggplot2 seems to permit different scales for different facets, but I fail to see how one could control ylim and xlim ranges for each facet separately. For instance, I would like to set the ylim = c(0,10) for facet A and ylim = c(42,102) for facet B. Since the data is out of these

Re: [R] Setting scales for ggplot2 with facets

2010-09-11 Thread Jonathan Christensen
Swen, facet_grid forces the scale for plots along an axis to be shared. Try facet_wrap instead. Jonathan On Sat, Sep 11, 2010 at 2:21 PM, Sven Laur s...@math.ut.ee wrote: Faceting in ggplot2 seems to permit different scales for different facets, but I fail to see how one could control ylim

Re: [R] Setting scales for ggplot2 with facets

2010-09-11 Thread Sven Laur
This does not solve the problem, as I still do not know how to control the y-range for individual facets. Data contains some outliers which make the y-range too wide for me and I would explicitly set the ylim = c(0,10) for facet A and ylim = c(42, 102) for facet B. How should I do it? On 11 Sep

Re: [R] Setting scales for ggplot2 with facets

2010-09-11 Thread Dennis Murphy
Use scales = 'free' in facet_wrap() to vary both scales across panels. From Ch. 7 of the ggplot2 book, the options are (in either type of faceting) scales = 'fixed' = both x and y scales are fixed in all plots scales = 'free_x'= fix y scale, vary x scale across panels scales = 'free_y'