In developing a gWidgets interface to plotting data and model results, I create a plot page and with par(mfrow=c(4,1))
to put 4 plots stacked up.
The first plot (a simple y vs. x on the top) works fine, but the remaining 3 plots in the loop create axes but plot no data. To test the code, I tried opening a new plot window before looping through the plots, and all worked fine.
Is there something in gwdigets
interaction with plot(...)
that would be useful to know?
EDIT a reproducible example:
doesn't work:
library(gWidgets)
options(guiToolkit="RGtk2") ## "Qt"
w <- gwindow("brush example", visible=FALSE)
g <- ggroup(container=w)
gg <- ggraphics(container=g)
addHandlerChanged(gg, handler=function(h,...) {
par(mfrow=c(2,2))
plot(mpg ~ wt, mtcars)
plot(mpg ~ wt, mtcars,col='blue')
plot(mpg ~ wt, mtcars,col='red')
plot(mpg ~ wt, mtcars,col='green')
})
visible(w) <- TRUE
should look like this (normal R graphics window:
Not like this