简体   繁体   中英

Error in plot.new() : figure margins too large in gwidgets2

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. 

您是否尝试扩大绘图窗口?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM