plot.new has not been called yet

后端 未结 6 1692
北荒
北荒 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:19

    I had the same problem... my problem was that I was closing my quartz window after plot(x,y). Once I kept it open, the lines that previously resulted in errors just added things to my plot (like they were supposed to). Hopefully this might help some people who arrive at this page.

提交回复
热议问题