Re: [R] how to enclose two xyplot

From: Felix Andrews <felix_at_nfrac.org>
Date: Fri, 15 Apr 2011 21:12:11 +1000

Hi,

Could you not simplify your a and b plots into one like

xyplot(NDVI_P10 + AVG_NDVI_P10 ~ dek_num | Year,

    data=data, lty = 3:2, col = c("darkgrey", "black"), ..., [etc]     auto.key = list(lines = TRUE, points = FALSE))

Otherwise please provide a commented, minimal, self-contained, reproducible example.

Regards
Felix

On 15 April 2011 18:25, Francesco Nutini <nutini.francesco_at_gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> Sorry, my previous mail was incomplete.
>
> I mean, one of my xyplot is build with the command "doubleYScale" (in order to overlap two line with different Y-axis).
> But  "doubleYScale"  doesn't run with the nice command that you have suggested:
>
> first plot:
>
>
>
>
> a<-xyplot(NDVI_P10~dek_num
> | Year, type="a", data=data, xlim=c(1,37),  ylim=c(0.1,0.8), as.table = TRUE, layout =
> c(13,1), aspect = 2, col="darkgrey",
> col.axis="black", lwd=3, grid=T, par.settings =
> list(strip.background = list(col = c("gray90"))))
> second plot:
>
>
>  b<-xyplot(AVG_NDVI_P10~dek_num | Year,
> type="a", data=data, xlim=c(1,37),
> ylim=c(0.1,0.8), as.table = TRUE, layout = c(13,1), aspect = 2,  col="black",
> col.axis="black", lwd=2)
> overlap first and second:
>
>
> double<- update(doubleYScale(a,
> b, add.ylab2 = TRUE), par.settings = simpleTheme(col =
> c("black","black")))
> third plot:
>
>
> z<- xyplot(z_NDVI_P10
> ~dek_num | Year, type="h", data=data, xlim=c(1,37),  ylim=c(-2.5,2.5), as.table = TRUE, layout =
> c(13,1), aspect = 2, col="black",
> col.axis="black", lwd=3, grid=T, par.settings =
> list(strip.background = list(col = c("gray90"))))
> enclose (?c.trellis):
>
>
>
>
> c( z,double, x.same = TRUE, y.same = T, layout = c(13,2))
>
> Maybe there is no solution but, anyway, thanks for help!
> francesco
>
>
>
>
>
>
>
>
> From: nutini.francesco_at_gmail.com
> To: baptiste.auguie_at_googlemail.com
> CC: r-help_at_r-project.org
> Subject: RE: [R]  how to enclose two xyplot
> Date: Thu, 14 Apr 2011 15:31:12 +0000
>
>
>
>
>
>
>
>
> ok ?c.trellis works well.
> But I still have a problem.
>
> One of my plot is a combination of two xyplot on different scales:
>
>
>
> a<-xyplot(NDVI_P10~dek_num
> | Year, type="a", data=data, xlim=c(1,37),  ylim=c(0.1,0.8), as.table = TRUE, layout =
> c(13,1), aspect = 2, col="darkgrey",
> col.axis="black", lwd=3, grid=T, par.settings =
> list(strip.background = list(col = c("gray90"))))
>
> b<-xyplot(AVG_NDVI_P10~dek_num | Year,
> type="a", data=data, xlim=c(1,37),
> ylim=c(0.1,0.8), as.table = TRUE, layout = c(13,1), aspect = 2,  col="black",
> col.axis="black", lwd=2)
>
> update(doubleYScale(a, b, add.ylab2 =
> TRUE), par.settings = simpleTheme(col =
> c("black","black")))
>
>
>
>
>
> From: nutini.francesco_at_gmail.com
> To: baptiste.auguie_at_googlemail.com
> CC: r-help_at_r-project.org
> Subject: RE: [R] FW: [r] how to enclose two xyplot
> Date: Thu, 14 Apr 2011 07:46:31 +0000
>
>
>
>
>
>
>
>
> Did you mean this?
> http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=latticeExtra:c.trellis
>
> In fact I'm already using latticeExtra package because my xyplot is little bit complicated...
> So, I'm tring, thanks fro tricks baptiste!
>
> Francesco
>
>
>> Date: Thu, 14 Apr 2011 08:52:45 +1200
>> Subject: Re: [R] FW: [r] how to enclose two xyplot
>> From: baptiste.auguie_at_googlemail.com
>> To: nutini.francesco_at_gmail.com
>> CC: r-help_at_r-project.org
>>
>> Hi,
>>
>> Have you tried ?c.trellis in the latticeExtra package?
>>
>> HTH,
>>
>> baptiste
>>
>> On 13 April 2011 23:36, Francesco Nutini <nutini.francesco_at_gmail.com> wrote:
>> >
>> >  Dear R-users,
>> >
>> > I have to plot two xyplot, and I wish to enclose this two graphs with just one headline, the same x scale, the same grid etc.
>> > These parameters should tie in, in order to obtain, visually, a unique graph formed by two xyplot.
>> >
>> > I try to give an idea:
>> >
>> > xyplot1: |_|_|_|
>> >
>> >
>> >
>> > xyplot2: |_|_|_|
>> >
>> >
>> >
>> > what i want: |  |  | |
>> >
>> >                   |_|_|_|
>> >
>> >
>> > I tried to use the command "par", but it's doesn't work with xyplot. The two plot have, by default, the same x-axis scale.
>> > I know it's just a "visual solution", but it could be nice for a paper!
>> >
>> > Thanks a lot,
>> >
>> > Francesco Nutini
>> > PhD student
>> >
>> >
>> >
>> >
>> >
>> >        [[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.
>> >
>
>        [[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.
>

-- 
Felix Andrews / 安福立
http://www.neurofractal.org/felix/

______________________________________________
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.
Received on Fri 15 Apr 2011 - 11:14:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 15 Apr 2011 - 12:20:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive