On Fri, Feb 20, 2009 at 01:34:02AM -0800, Chris Bennett wrote:
> I want to add a dashed vertical line to a number of xyplots.
> 
> Here is a simple script of the type of plot I have but then I want to add a
> reference line to 1995 on each of the panels.  I have tried panel.abline and
> other suggestions on the forum but can't get it to work.
> 
> plot<-rep(letters[1:3],each=10)
> year<-rep(1991:2000,times=3)
> matter<-rep(seq(2,6.5,0.5),times=3)
> xyplot(matter~year|plot,type="l")

The panel function is the way to go:

xyplot( matter~year|plot,
        type="l",
        panel=function(...){
                panel.xyplot(...)
                panel.abline(v=1995)
        }
)


BTW: it is not a good idea to use the name of builting functions as a
variable name (plot).

cu
        Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

______________________________________________
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.

Reply via email to