0
votes

I am trying to plot a chart but get this error only the first time I try to plot it which is weird.

w <- gwindow(title="Plots")
g=ggraphics(cont=w,visible=FALSE)
plot(x,y,xlab = "Period",ylab = "Scores",main = "Results",type = "l")
visible(w) <- TRUE

Now I get the subject line error. If I again run the plot(), I see the plot in the window. How can I avoid this. Thanks. 
2

2 Answers

0
votes

did you tried to expand the plotting window?

0
votes

The issue is the graphic widget hasn't been realized before the plot is trying to draw to it. The easiest trick is to pause a short amount before plotting with Sys.sleep. Fancier uses, are to render the plot within a realize handler.