[R] xyplots
Nathan Leon Pace, MD, MStat
N.L.Pace at m.cc.utah.edu
Wed Sep 28 23:14:10 CEST 2005
Thanks for suggestions on plotting different symbols in an xyplot by
Sarkar and Wiener in answer to my question:
"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."
Wiener:
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,
Sarkar:
Not directly. You do need to change the plotting character (pch). Here
are two ways to do it (the second is longer but recommended):
dotplot(variety ~ yield | site, data = barley, groups = year, pch = c
(1, 16))
dotplot(variety ~ yield | site, data = barley, groups = year,
auto.key = TRUE,
par.settings = list(superpose.symbol = list(pch = c(1, 16))))
A related question:
My xyplot is essentially a time series (up-and-down experimental
design). Thus I need to connect the points sequentially regardless of
the group value. With the groups argument, type = 'b' gives two lines
- one for each group.
Any more suggestions?
Thanks,
Nathan
More information about the R-help
mailing list