Patrick Lorch
2004-Jul-16 21:32 UTC
[R] highlighting subset of point with xyplot (or Hmisc(xYplot))
Hello all, I am trying to use xyplot to give a six panel plot and to highlight only points (in any panel) that meet a certain criterion. With the plot command I would do something like: plot.default(filein$Site,filein$circ.conc) points(filein$Site,filein$circ.conc,type="p", pch=ifelse(filein$p.value<5e-02,19,21)) I had thought I could just stick in the pch line from above into either xyplot or xYplot with groups set to Site like: xyplot(circ.conc~Day|Site,data=allsites.byday,groups=Site, pch=ifelse(allsites.byday$p.value<5e-02,19,21)) This does not produce any highlighting (all symbols come out as open circles (19)). I have not messed with writing my own panel functions, though I know that is where the solution must lie. Hopefully someone has an example that is close enough to help me. I can send an example plot to anyone that wants one. Thanks, -Pat Dr. Patrick D. Lorch plorch at email.unc.edu http://www.unc.edu/~plorch/lorch.html Department of Biology W: 919-843-2320 University of North Carolina F: 919-962-1625 at Chapel Hill CB#3280, Coker Hall Chapel Hill, NC 27599-3280 USA
Deepayan Sarkar
2004-Jul-16 21:42 UTC
[R] highlighting subset of point with xyplot (or Hmisc(xYplot))
On Friday 16 July 2004 16:32, Patrick Lorch wrote:> Hello all, > I am trying to use xyplot to give a six panel plot and to highlight > only points (in any panel) that meet a certain criterion. With the > plot command I would do something like: > plot.default(filein$Site,filein$circ.conc) > points(filein$Site,filein$circ.conc,type="p", > pch=ifelse(filein$p.value<5e-02,19,21)) > I had thought I could just stick in the pch line from above into either > xyplot or xYplot with groups set to Site like: > xyplot(circ.conc~Day|Site,data=allsites.byday,groups=Site, > pch=ifelse(allsites.byday$p.value<5e-02,19,21)) > This does not produce any highlighting (all symbols come out as open > circles (19)). I have not messed with writing my own panel functions, > though I know that is where the solution must lie. Hopefully someone > has an example that is close enough to help me. I can send an example > plot to anyone that wants one.It's difficult to check without data, but I believe the following would work: xyplot(circ.conc ~ Day | Site, data=allsites.byday, ## groups=Site, I don't see the point of this groups = p.value<5e-02, pch = c(19, 21)) Note that I have removed the original groups variable, because I don't see a point in having that (since Site is already used as a conditioning variable). If you really need another grouping variable, then this would become slightly more complicated. Deepayan