The more common way to do this is to use groups, the default is to have a different color for each group, but you can change that using trellis.par.set:
tmp <- trellis.par.get() tmp$superpose.symbol$pch = 0:10 trellis.par.set(tmp) xyplot(Sepal.Width ~ Petal.Width, data=iris, groups=Species, auto.key=TRUE) If you need more control of the symbols than that, then look at the panel.my.symbols function in the TeachingDemos package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of John Poulsen > Sent: Thursday, February 10, 2011 2:22 PM > To: r-help@r-project.org > Subject: [R] Calling symbols from dataframe for xyplot > > Hello, > > I am trying to make a xyplot plot with points that are different > symbols. I want to call the symbol type (pch) from a column in my > dataframe. Here is a simplified example. In my real example I also > have groups, which I have not included here. This example doesn't > change the symbols or colors. > > Any help you can provide would be appreciated. > > Thanks, > John > > x<-c(1:12) > y<-c(rpois(12,4)) > grp<-c(rep(c(3,4), each=6)) > z<-c(rep(c(1,2), each=6)) > p<-rep(1:3,4) > > xyplot(y~x|z, cex=1.2, > panel=function(x,y,...){ > panel.xyplot(x,y,...) > pch=p > fill=list("black","blue")}) > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > 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. ______________________________________________ R-help@r-project.org mailing list 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.