[R] Help needed with lattice graph!

Sander Oom slist at oomvanlieshout.net
Fri Apr 22 10:29:53 CEST 2005


Dear R users,

If I manage to sort out this graph, it is certainly a candidate for the 
new R graph gallery 
(http://addictedtor.free.fr/graphiques/displayGallery.php)!

I created the following lattice graph:

library(lattice)
tmp <- expand.grid(geology = c("Sand","Clay","Silt","Rock"),
   species = 
c("ArisDiff","BracSera","CynDact","ElioMuti","EragCurS","EragPseu"),
   dist = seq(1,9,1) )
tmp$height <- rnorm(216)
sps <- trellis.par.get("superpose.symbol")
sps$pch <- 1:6
trellis.par.set("superpose.symbol", sps)
   xyplot( height ~ dist | geology, data = tmp,
     groups = species, type = "b", cex = 1.2,
     layout = c(2,2),
     lines = list(col="grey"),
     key = list(columns = 2, type = "b", cex = 1.2,
       text = list(paste(unique(tmp$species))),
       points = Rows(sps, 1:6)
       )
   )

However, for once, the R defaults are not to my liking. I plot the graph 
to postscript and the result is less then optimal.

I would like to plot the point symbols in black and white, both in the 
graphs and the key. I would like the lines to be a single style (grey or 
a light dash) and preferably the lines do not go through the symbols 
(like figure 4.11 in the MASS book).

I have tried many, many options, but results varied from wrong symbols 
to wrong things plotted. Splitting the lines and points over different 
panels seems the way, but I can not make it work.

Your help is much appreciated! This graph and the resulting black and 
white graph will be posted on the R graph gallery.

Thanks,

Sander.




-- 
--------------------------------------------
Dr. Sander P. Oom
Animal, Plant and Environmental Sciences,
University of the Witwatersrand
Private Bag 3, Wits 2050, South Africa
Tel (work)      +27 (0)11 717 64 04
Tel (home)      +27 (0)18 297 44 51
Fax             +27 (0)18 299 24 64
Email   sander at oomvanlieshout.net
Web     www.oomvanlieshout.net/sander




More information about the R-help mailing list