[R] Adding data to existing plot with new=TRUE does not appear to work

Paul Lemmens paul.lemmens at gmail.com
Wed Jul 4 09:48:15 CEST 2007

Dear all,

I am trying to shove a number of cmdscale() results into a single plot
(k=1 so I'm trying to get multiple columns in the plot).  From ?par I
learned that I can/should set new=TRUE in either par() or the plot
function itself. However with the following reduced code, I get only a
plot with a column of data points with x==2.

plot(1,10, xlim=range(0,3), ylim=range(0,10), type='n')
aa <- rep(1,10)
bb <- 1:10
plot(aa,bb, xlim=range(0,3), ylim=range(0,10), new=TRUE)
aa <- rep(2,10)
plot(aa,bb, xlim=range(0,3), ylim=range(0,10), new=TRUE)

Also, when I insert a op <- par(new=TRUE) either before or immediately
after the first plot statement (the type='n' one) in the above code
fragment, the resulting graph still only shows one column of data.

Have I misinterpreted the instructions or the functionality of new=TRUE?

Thank you,
Paul Lemmens

More information about the R-help mailing list