“尚未调用plot.new"rmarkdown 中的错误(Rstudio 1.0.44) [英] "plot.new has not been called yet" error in rmarkdown (Rstudio 1.0.44)

查看:128
本文介绍了“尚未调用plot.new"rmarkdown 中的错误(Rstudio 1.0.44)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 iMac 上使用最新版本的 Rstudio

I am using a recent version of Rstudio with an iMac

版本 1.0.44 – © 2009-2016 RStudio, Inc. Mozilla/5.0 (Macintosh;英特尔 Mac OS X 10_12_1) AppleWebKit/602.2.14(KHTML,如 Gecko)

Version 1.0.44 – © 2009-2016 RStudio, Inc. Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko)

我注意到了 rmarkdown 文件的 notebook 功能.生成绘图时,不再使用通常的绘图窗口",而是在代码块下方生成绘图.

And I noticed the notebook function for rmarkdown files. When generating plots, the usual "Plots window" is not used any more, and the plots are generated just below the code chunk.

我有以下代码错误:

plot(seq(1,10,1))
abline(a=0,b=1)

错误显示在代码块下方:

The error is showed below the code chunk :

Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : plot.new has not been called yet

然而,编织整个 rmarkdown 文件时,没有错误.

However, when knitting the whole rmarkdown file, there is no error.

所以我想知道如何避免错误:

So I would like to know how to avoid the error:

  • 使用其他代码
  • 使用绘图窗口"
  • 或其他方式.

推荐答案

以下内容有效

{plot(seq(1,10,1))
 abline(a=0,b=1)}

这篇关于“尚未调用plot.new"rmarkdown 中的错误(Rstudio 1.0.44)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆