【问题标题】:"print" versus "plot" in rr中的“打印”与“情节”
【发布时间】:2015-05-24 10:01:57
【问题描述】:

我想如下保存我的直方图。当我运行以下命令时,该图会显示在 Rstudio 中:

hist_L4 <- hist(L_4,breaks=10,main='histo')   
print(hist_L4)

当我尝试像这样保存它时,它只会保存空白的白色图像,这与它在 Rstudio 中打印的图不同。

hist_L4 <- hist(L_4,breaks=10,main='histo')    

png(file=paste0('path/name_of_png' , '.png' ))
print(hist_L4)
dev.off()

为什么我得到空白的白色地块?谢谢。

【问题讨论】:

  • 为什么不直接通过hist 调用。或者使用plot(hist_L4)
  • 顺便说一句,你确定print(hist_L4) 生成了一个情节,还是之前的hist_L4 &lt;- hist(... 调用打印了情节?

标签: r plot png rstudio


【解决方案1】:
#Maybe simply this way?:
hist_L4 <- hist(L_4,breaks=10,main='histo')   
hist_L4

png(file=paste0('path/name_of_png' , '.png' ))
hist_L4
dev.off()

【讨论】:

  • 在没有plot 调用的情况下是否可以工作...如plot(hist_L4)
猜你喜欢
  • 1970-01-01
  • 2014-05-31
  • 2021-01-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-24
  • 2015-11-03
  • 1970-01-01
相关资源
最近更新 更多