[R] Adding reference lines to xyplot

Rob Balshaw Rob.Balshaw at syreon.com
Mon Jan 20 21:38:03 CET 2003

I'm trying to add a set of reference lines to a multipanel xyplot

xyplot(y ~ x | Visit,
	panel = function(x, y, ...){
	panel.xyplot(x, y, ...)
	abline(v = c(0.5, 1))

However, the reference lines are different for different visits.  For
example, for the first 2 visits, I'd like vertical lines at x = 0.5 and 1.
For visits 3 and four, I'd like vertical lines at x = 1 and 1.5.  I can use
abline within the panel function, but I haven't found a way to say I want my
reference lines to change for different visits.

I've a feeling that the subscripts arguement is somehow involved, but I've
not found any examples or references to this.

Any suggestions?  Which page of the various manuals did I skim too quickly?



-- Robert Balshaw, Ph.D.
-- Senior Biostatistician, Syreon Corp.
-- Phone: 604.676.5900x220; Fax: 604.676.5911

More information about the R-help mailing list