[R] [FORGED] Extracting specified pages from a lattice ("trellis") object.

Duncan Mackay du|c@|m@ @end|ng |rom b|gpond@com
Tue Apr 24 16:23:26 CEST 2018


Hi Rolf

do you need to use the  layout argument?

The layout is conditioned by the levels of a or unique values if not a factor. easier with factor

unique(dta$a)
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l"
data.frame( a= unique(dta$a), page = rep(1:3, ea = 4), col = 1:2,row  = rep(1:2, ea = 2))
   a page col row
1  a    1   1   1
2  b    1   2   1
3  c    1   1   2
4  d    1   2   2
5  e    2   1   1
6  f    2   2   1
7  g    2   1   2
8  h    2   2   2
9  i    3   1   1
10 j    3   2   1
11 k    3   1   2
12 l    3   2   2

I hope I have got the order right

full dataset
xyplot(y~x|a,data=dta)


     bar  = xyplot(y~x|a,data = subset(dta, a %in% c("e","f","g","h")) ))

print(bar)
(missed the dotplot requirement) but principle is the same.

you can use packet.number or which.packet if needed to make it simpler

use par.settings to do colours lines etc as well as spacing.

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2350

-----Original Message-----
From: R-help [mailto:r-help-bounces using r-project.org] On Behalf Of Rolf Turner
Sent: Tuesday, 24 April 2018 15:52
To: Paul Murrell
Cc: r-help using r-project.org; deepayan.sarkar using r-project.org
Subject: Re: [R] [FORGED] Extracting specified pages from a lattice ("trellis") object.


On 24/04/18 15:17, Paul Murrell wrote:

> Hi
> 
> I think the subsetting works by giving you the panels for the 
> corresponding levels of the conditioning variable(s).  Note that, if 
> there is more than one conditioning variable, you will need more than 
> one subsetting index.
> 
> For example, taking this plot with two conditioning variables and 12 
> panels in total ...
> 
> dotplot(variety ~ yield | year * site, data=barley)
> 
> ... this produces three pages ...
> 
> dotplot(variety ~ yield | year * site, data=barley,
>          layout=c(2,2))
> 
> ... and this produces the second page (both panels for the first 
> conditioning variable and the third and fourth panels for the second 
> conditioning variable) ...
> 
> dotplot(variety ~ yield | year * site, data=barley,
>          layout=c(2,2))[1:2, 3:4]
> 
> Hope that helps.

Hmm.  Thanks Paul.  I may be able to work with that.  But what I really 
wanted was to take

     bar <- dotplot(variety ~ yield | year * site, data=barley)

and then do (something like)

     foo <- bar[<something>]

so that foo contains only the second page of bar, and then do print(foo)
to get a plot of (just) the second page.  Without re-issuing a 
(modified) plot command.

Is that not at all possible?

cheers,

Rolf.

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.




More information about the R-help mailing list