plot.new尚未被调用 [英] plot.new has not been called yet
问题描述
为什么会这样?
plot(x,y)
yx.lm <- lm(y ~ x)
lines(x, predict(yx.lm), col="red")
plot.xy(xy.coords(x, y), type = type, ...)
中的错误:plot.new
尚未被调用
Error in
plot.xy(xy.coords(x, y), type = type, ...)
:plot.new
has not been called yet
推荐答案
某些动作(很有可能未在可见代码中表示)已关闭了交互式屏幕设备.可以通过单击关闭按钮来完成. (在绘制到文件图形设备时,也可以通过额外的dev.off()完成.如果您粘贴多行绘图命令,但该命令的末尾带有dev,off()却可能会出错,则可能会发生这种情况在外部设备的打开位置退出,但随后将dev.off()放在单独的行上,因此意外关闭了交互式设备.
Some action, very possibly not represented in the visible code, has closed the interactive screen device. It could be done either by a "click" on a close-button. (Could also be done by an extra dev.off() when plotting to a file-graphics device. This may happen if you paste in a mult-line plotting command that has a dev,off() at the end of it but errors out at the opening of the external device but then has hte dev.off() on a separate line so it accidentally closes the interactive device).
某些(大多数?)R实现将启动自动打开的屏幕图形设备,但是如果将其关闭,则需要重新初始化它.在Windows上可能是window()
;在Mac上,为quartz()
;并在Linux机器上的x11()
上.您可能还需要发出plot.new()
命令.我只是按照命令.当我收到该错误时,发出plot.new()
,如果没有看到绘图窗口,也发出quartz()
.然后,我从头开始使用新的plot(., ., ...)
命令以及对该绘图屏幕图像的任何其他添加.
Some (most?) R implementations will start up a screen graphics device open automatically, but if you close it down, you then need to re-initialize it. On Windows that might be window()
; on a Mac, quartz()
; and on a linux box, x11()
. You also may need to issue a plot.new()
command. I just follow orders. When I get that error I issue plot.new()
and if I don't see a plot window, I issue quartz()
as well. I then start over from the beginning with a new plot(., ., ...)
command and any further additions to that plot screen image.
这篇关于plot.new尚未被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!