[R] Layout of mulitpage conditioned lattice plots

Thomas Adams Thomas.Adams at noaa.gov
Sun Dec 19 18:14:48 CET 2010


  Dennis,

Thank you; this helps me, too!

Tom

On 12/19/10 11:45 AM, Dennis Murphy wrote:
> Hi Dieter:
>
> If I read your intention correctly, you need a third element in layout = .
> Here's a little example:
>
> df<- data.frame(month = rep(month.abb, each = 20),
>                    time = rep(1:20, 12),
>                    y = rnorm(240))
> xyplot(y ~ time | month, data = df, layout = c(2, 2, 3))
>
> This produces 3 pages of 2 x 2 plots.
>
> Hope this is what you had in mind..
>
> Dennis
>
> On Sun, Dec 19, 2010 at 8:23 AM, Dieter Menne
> <dieter.menne at menne-biomed.de>wrote:
>
>> Dear latticists,
>>
>> I would like to spread a lattice conditioned plot over multiple pages,
>> keeping the same layout as if I had only one page as shown in the code
>> below.
>>
>> My workaround is to divide the dataframe into subset that fit on one page,
>> but the code is ugly.
>>
>> Is there a build-in way to achieve this?
>>
>> Dieter
>>
>>
>>
>> library(lattice)
>> nsubj = 13 # This number is variable
>> dt = expand.grid(time=1:20,comp=LETTERS[1:3],subj=letters[1:nsubj])
>> dt$val = rnorm(nrow(dt))
>>
>> #pdf(file="multpageOk.pdf")
>> # How it should look:
>> xyplot(val~time|subj+comp, data=dt,type="l",layout=c(10,3),
>>   subset=as.integer(subj)<= 10)
>> #dev.off()
>>
>> # What to do if it stretches over multiple pages, but I want the same
>> # layout as above?
>> pdf(file="multpage.pdf")
>> xyplot(val~time|subj+comp, data=dt,type="l",layout=c(10,3))
>> dev.off()
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/Layout-of-mulitpage-conditioned-lattice-plots-tp3094581p3094581.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>


-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:	thomas.adams at noaa.gov

VOICE:	937-383-0528
FAX:	937-383-0033



More information about the R-help mailing list