[R] More help with Lattice

Deepayan Sarkar deepayansarkar at yahoo.com
Wed Aug 21 21:12:27 CEST 2002

--- Jean-Pierre Gattuso <gattuso at obs-vlfr.fr> wrote:
> Hi:
> Thanks a lot to Deepayan Sarkar, author of lattice I think, who 
> solved my first query. I am afraid that I have another one.
> I am plotting several mutipanels boxplots (with one conditioning 
> variable) on one page. The x, y and conditioning variable are all 
> continuous variables. The x and conditioning variables are 
> transformed to shingles before being plotted. The plot looks nice but 
> there are two changes that I cannot manage to do.
> 1- The labels displayed on the y axis are of course the categories of 
> the shingle. I would like to display instead the actual intervals of 
> the shingle. Is that possible?

This one's easy. For example, 

x <- rnorm(100)
y <- equal.count(rnorm(100))
z <- equal.count(rnorm(100))

ylabels <- substring(as.character(levels(y)), 2)
## or,  if these are too long
## ylabels <- substring(as.character(lapply(levels(y), round, 3)), 2)

bwplot(y ~ x | z, scales = list(y = list(labels = ylabels)))

> 2- It is even worse for the conditioning variable because its name is 
> displayed, with no information on the interval that it represents in 
> each panel (except the colored rectangle that moves along the strip). 
> Anyway, I got rid of the strip because vertical space is at premium 
> on this page. Here too, I would like to display the interval of the 
> conditioning variable on each panel. Andrew C. Ward suggested that I 
> should use ltext in a panel function but I did not succeed.

This might be a problem if you don't want to use the strip function, since a
panel function is usually not sent any information about which levels of the
conditioning variable it corresponds to. With strip, it should be easy:

zlabels <- substring(as.character(levels(z)), 2)
bwplot(y ~ x | z, strip = function(which.given, ...)    
## assuming that you have only one conditioning variable

> What is the documentation available for lattice? I have "Tour of 
> Trellis" (Becker et al.) and the S user's manual on Treillis. These 
> documents, together with the help pages, got me quite a long way. 
> However, some instructions are not very clear (at least for a newbie, 
> with no programming expertise), especially for the use of panel 
> functions. Is there any other documentation available? I know, I 
> could have gone the R-help archives but I am out of the office and 
> rely on a slow and rather unreliable Internet connection.

Currently, there's not much else. (Incidentally, everything I used is
documented in the help pages, although they might be a bit difficult to find.)
A web page is in the making (at packages.r-project.org/lattice), but I haven't
gotten around to really starting it up yet. 

> I am sorry to have produced such a long msg.
> Thanks in advance for your help.
> jp
> -- 
> ____________________________________________________________________
> Jean-Pierre Gattuso
> Laboratoire d'Océanographie de Villefranche, UMR 7093 CNRS-UPMC
> B. P. 28, F-06234 Villefranche-sur-mer Cedex - France
> Voice: +33 (0)493763859 - Fax: +33 (0)493763834
> <mailto:gattuso at obs-vlfr.fr> - http://www.obs-vlfr.fr/~gattuso
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list