[R] Multiple plots on same graph

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jul 6 08:19:29 CEST 2003


On Sat, 5 Jul 2003, Paul, David  A wrote:

> R1.7, Win2k:
> 
> I have some Splus code that has allowed me, in the past,
> to place multiple plots on the same graph:
> 
> 
> plot(y1 ~ x1, data = foo1.frame, type = "l", xlab="",ylab="", 
>      xlim=c(...,...), ylim=c(...,...), axes=F)
> par(new=T, xaxs = "d", yaxs = "d")
> plot(y2 ~ x2, data = foo2.frame, col = 2)
> 
> 
> However, I get the error message
> "Error in plot.new() : axis style "d" unimplemented"
> Can anyone recommend a way for me to accomplish the same
> thing as the code above?  If I simply use par(new=T),
> the produced graph contains elements that do not correspond
> to the same axis-scales.

Use lines() or points() to add to the existing graph.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list