[R] superimposing xyplots on same scale

Felix Andrews felix at nfrac.org
Fri Sep 25 02:29:33 CEST 2009


Um, no, please use doubleYScale() in latticeExtra, rather than as.layer().

However, in your case, why don't you just do a standard lattice plot like

xyplot(time_pct + pct_compl ~ date,
   par.settings = simpleTheme(col = c("blue", "red")),
   type="b",
   pch=15,
   ...)

If you gave a reproducible example I could give you a reproducible solution.

Cheers
-Felix


2009/9/24 baptiste auguie <baptiste.auguie at googlemail.com>:
> Hi,
>
> try ?as.layer in the latticeExtra package.
>
> HTH,
>
> baptiste
>
> 2009/9/24 Larry White <ljw1001 at gmail.com>:
>> I have two xyplots that i want to superimpose (code below).  By default they
>> are displayed on slightly different y scales (one runs from 10 to 25, the
>> other from 10 to 30). I would like to force them both onto the same scale
>> (10 to 30) so the relation between the two is clear. Is there a way to do
>> this?
>> thanks much
>>
>>
>> pct_compl_chart <- xyplot(pct_compl ~ date,
>> col="red",
>> type="b",
>> pch=15,
>> scalse=list(tick.number=5),
>> ylab=list(label="Pct. Compl."),
>> layout=c(1,5),
>> xlab=list(label=""),
>> between = list(x = c(0, 0, 0), y = c(8,-10,-10,-10,-10))
>> )
>>
>> time_pct_chart <- xyplot(time_pct ~ date,
>> col="blue",
>> type="b",
>> pch=15,
>> scales=list(tick.number=5),
>> ylab=list(label=""),
>> layout=c(1,5),
>> xlab=list(label=""),
>> between = list(x = c(0, 0, 0), y = c(8,-10,-10,-10,-10))
>> )
>>
>>        [[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.
>



-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 1670
E: felix.andrews at anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/




More information about the R-help mailing list