[R] xyplots

Wiener, Matthew matthew_wiener at merck.com
Wed Sep 28 22:57:00 CEST 2005

> library(lattice)
> temp1 <- data.frame(x = runif(100), y = runif(100), ind1 = sample(1:4,
100, replace = TRUE), ind2 = sample(1:4, 100, replace = TRUE))
> xyplot(y~x |ind1, groups = ind2, data = temp1, pch = c(1, 2, 3, 16))

You don't even need to tell it to use panel.superpose -- using "groups"
tells it (try it with & without and see!).

The pch values are set by group (here, value of ind2).  It might be more
elegant to use trellis.par.set to set the pch values, but I'm lazy.  (It
seems to have the desired effect -- try subsetting on ind2, and you get a
subset of the values.)

Hope this helps,

Matt Wiener

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Nathan Leon Pace, MD,
Sent: Wednesday, September 28, 2005 4:02 PM
To: r-help at stat.math.ethz.ch
Cc: Nathan Leon Pace, MD, MStat
Subject: [R] xyplots

Hi All,

I have a four panel xyplot. I wish to plot each point as an open or  
filled circle depending on the value of an indicator variable.

I assume I need to use panel.superpose(), but I can't figure out the  
syntax from lattice documentation.

Running R 2.1 under Mac OS X 10.4.2.

Any suggestions would be appreciated.


Nathan Leon Pace, MD, MStat
University of Utah
Salt Lake City, UT 84132
Office: 801.581.6393
Fax: 801.581.4367
Cell: 801.205.1019
Pager: 801.291.9019
Home: 801.467.2925

	[[alternative HTML version deleted]]

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

More information about the R-help mailing list