[R] in par(mfrow=c(1, 2)), how to keep one half plot static and the other half changing

Baoqiang Cao bqcaomail at gmail.com
Tue Nov 27 16:46:42 CET 2012


Hi,

I'm trying to plot something in the following way and would like if
you could help:

I'd like in a same plot window, two plots are shown, the left one is a
bird-view plot of the whole data, the right half keep changing, i.e.,
different plots will be shown up on request, so that when I
select/click on some where in the left plot, the right plot will be
the corresponding plot.

What I did is:

par(mfrow=c(1,2))
plot(x, y)

while(1) {
...
pxy <- locator(1, type="p")

#select data point (dx,dy) based on pxy for a new plot
..

plot(dx,dy)
}

I ended up with the left plot is overwritten by plot(dx,dy). Is there
anyway to keep the left side intact while changing plots on the right
side?


Thanks a lot!

Baoqiang



More information about the R-help mailing list