[R] highlighting subset of point with xyplot (or Hmisc(xYplot))
Deepayan Sarkar
deepayan at stat.wisc.edu
Fri Jul 16 23:42:21 CEST 2004
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
More information about the R-help
mailing list