Lattice xyplot: same scales within one factor

View: New views
5 Messages — Rating Filter:   Alert me  

Lattice xyplot: same scales within one factor

by Orion Buske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using R 2.8.1 and lattice to produce xyplots conditioned on
two factors. What I would like is to have the scales be free between values
of one factor, but some within. Thus, in the example:

xyplot(mpg ~ disp | factor(gear) + factor(cyl), mtcars,
        scales=list(x=list(relation="free")))

rather than having the x scales be free within a gear as well, I want it to
be the same for the gear, but free between cyl (and thus only have x scales
below the bottom panels with no scales or white space in the middle between
panels).

Any help would be greatly appreciated

-Orion

        [[alternative HTML version deleted]]

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

Parent Message unknown Lattice xyplot: same scales within one factor

by Orion Buske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using R 2.8.1 and lattice to produce xyplots conditioned on
two factors. What I would like is to have the scales be free between values
of one factor, but some within. Thus, in this example,

xyplot(mpg ~ disp | factor(gear) + factor(cyl), mtcars,
        scales=list(x=list(relation="free")))

rather than having the x scales be free within a gear as well, I want it to
be the same for the gear, but free between cyl (and thus only have x scales
below the bottom panels with no scales or white space in the middle between
panels).

Any help would be greatly appreciated!

-Orion

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

Parent Message unknown Lattice xyplot: same scales within one factor

by Orion Buske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using R 2.8.1 and lattice to produce xyplots conditioned on
two factors. What I would like is to have the scales be free between values
of one factor, but some within. Thus, in this example,

xyplot(mpg ~ disp | factor(gear) + factor(cyl), mtcars,
        scales=list(x=list(relation="free")))

rather than having the x scales be free within a gear as well, I want it to
be the same for the gear, but free between cyl (and thus only have x scales
below the bottom panels with no scales or white space in the middle between
panels).

Any help would be greatly appreciated!

-Orion

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

Re: Lattice xyplot: same scales within one factor

by Deepayan Sarkar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jul 13, 2009 at 8:33 AM, OB<o.borderline@...> wrote:

> I am using R 2.8.1 and lattice to produce xyplots conditioned on
> two factors. What I would like is to have the scales be free between values
> of one factor, but some within. Thus, in this example,
>
> xyplot(mpg ~ disp | factor(gear) + factor(cyl), mtcars,
>         scales=list(x=list(relation="free")))
>
> rather than having the x scales be free within a gear as well, I want it to
> be the same for the gear, but free between cyl (and thus only have x scales
> below the bottom panels with no scales or white space in the middle between
> panels).

Per-variable scales are not supported by lattice. You can sort of fake
it by providing explicit limits and playing around with spacing, but
it's fairly ugly.

-Deepayan

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

Re: Lattice xyplot: same scales within one factor

by Orion Buske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you! I ended up hunting down a few previous posts you made and getting
it to to work, although yes, it was not pretty.

-Orion

On 8/3/09 10:30 am, "Deepayan Sarkar" <deepayan.sarkar@...> wrote:

> On Mon, Jul 13, 2009 at 8:33 AM, OB<o.borderline@...> wrote:
>> I am using R 2.8.1 and lattice to produce xyplots conditioned on
>> two factors. What I would like is to have the scales be free between values
>> of one factor, but some within. Thus, in this example,
>>
>> xyplot(mpg ~ disp | factor(gear) + factor(cyl), mtcars,
>>         scales=list(x=list(relation="free")))
>>
>> rather than having the x scales be free within a gear as well, I want it to
>> be the same for the gear, but free between cyl (and thus only have x scales
>> below the bottom panels with no scales or white space in the middle between
>> panels).
>
> Per-variable scales are not supported by lattice. You can sort of fake
> it by providing explicit limits and playing around with spacing, but
> it's fairly ugly.
>
> -Deepayan

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