plot.new has not been called yet

后端 未结 6 1693
北荒
北荒 2020-12-01 12:13

Why does this happen?

plot(x,y)
yx.lm <- lm(y ~ x)
lines(x, predict(yx.lm), col=\"red\")

Error in plot.xy(xy.coords

6条回答
  •  天涯浪人
    2020-12-01 12:34

    If someone is using print function (for example, with mtext), then firstly depict a null plot:

    plot(0,type='n',axes=FALSE,ann=FALSE)
    

    and then print with newpage = F

    print(data, newpage = F)
    

提交回复
热议问题