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'    => fix x scale, vary y scale
scales = 'free'        => vary both

HTH,
Dennis

On Sat, Sep 11, 2010 at 2:17 PM, Sven Laur <s...@math.ut.ee> wrote:

> 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 2010, at 23:37, Jonathan Christensen wrote:
>
> > 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 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
> > ranges,
> > setting facet_grid(factor ~ ., scales = "free_y") does not achieve
> > the goal .
> >
> > Is there a decent way to achieve this or not? or I have to drop data
> > points
> > outside y-ranges as a quick hack?
> >
> >
> > Swen Laur
> >
> > ______________________________________________
> > R-help@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.
> >
>
> Swen Laur
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to