[R] adding a reference line to an xyplot

baptiste auguie ba208 at exeter.ac.uk
Fri Feb 20 11:56:19 CET 2009


Another approach using latticeExtra, more ggplot2-like:

p <- xyplot(matter~year|plot,type="l")

p +
latticeExtra::layer(panel.abline(v=1995))



On 20 Feb 2009, at 09:34, Chris Bennett wrote:

>
>
> Hi,
>
> 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")
>
> Cheers,
> Chris
> --
> View this message in context: http://www.nabble.com/adding-a-reference-line-to-an-xyplot-tp22117545p22117545.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.

_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag



More information about the R-help mailing list