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

Petr PIKAL petr.pikal at precheza.cz
Wed Jul 4 11:22:31 CEST 2007


Hi

if you change your code

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)
par(new=T)
plot(aa,bb, xlim=range(0,3), ylim=range(0,10), new=TRUE)

you will get both columns plotted.

However you can get similar result with using points

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

Regards

Petr
petr.pikal at precheza.cz

r-help-bounces at stat.math.ethz.ch napsal dne 04.07.2007 09:48:15:

> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.



More information about the R-help mailing list