[R] multiple graphics windows open
Erin Hodgess
erinm.hodgess at gmail.com
Thu Jul 29 21:21:11 CEST 2010
Dear R People:
Now I have a function with 3 graphics windows. I'd like for them all
to be visible. However, the first window goes blank. Here is the
basic setup. The first plot is the entire series. The user selects
two points, which in turns generates a subset plot and an EWMA subset
plot. Finally, if things worked right, the user should be able to
click on "Tile Vertically" and see all 3 windows. Also, there should
be a line segment on the original plot connecting the two selected
points.
> library(zoo)
> xdate <- seq(as.Date("1998-01-01"),as.Date("2010-06-30"),by="day")
> length(xdate)
[1] 4564
> xt <- zoo(rnorm(4564),order=xdate)
> eplot
function (x)
{
x11()
plot(x)
z <- locator(2)
x11()
plot(window(x, start = min(z$x), end = max(z$x)))
dev.set(dev.prev())
segments(z$x[1],z$y[1],z$x[2],z$y[2],col="red")
dev.set(dev.next())
x11()
ewma(window(x, start = min(z$x), end = max(z$x)))
dev.set(dev.prev())
return(z)
}
> eplot(xt)
$x
[1] 9400.369 11592.073
$y
[1] 3.641633 3.353061
>
How do I get that original plot to appear without losing any of the
other plots, please?
Thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
More information about the R-help
mailing list