jupyter中的r图-无法启动png()设备 [英] r graphs in jupyter - unable to start png() device

查看:1689
本文介绍了jupyter中的r图-无法启动png()设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jupyter中使用R,但是无法在笔记本电脑中绘制图形.

I am using R in Jupyter, but unable to plot graphs in the notebook itself.

这是一个可复制的示例

set.seed(123)
mat = as.matrix(x = rnorm(100), y = rnorm(100))
plot(mat)

在Jupyter中:

Error in png(tf, width, height, "in", pointsize, bg, res, antialias = antialias): unable to start png() device
Traceback:

如果使用以下命令,可以将图像以 png 格式保存在当前工作目录中.

If I use following, I can save the image in png format in current working directory.

png('test.png')
plot(mat)
dev.off()

SessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

我已经关注了,但是没有一个能解决我的问题.

I have gone through following but none of them solve my problem.

  1. 在Jupyter中显示R中的ggplot2图
  2. 无法使用R内核在jupyter笔记本中进行绘图
  3. libXrender.so.1才能在线显示R个图
  4. 无法显示png
  5. 在GitHub上的R内核笔记本中呈现图形(与Github相关)
  1. Displaying ggplot2 graphs from R in Jupyter
  2. unable to plot in jupyter notebook using R kernel
  3. libXrender.so.1 is required to display R plots inline
  4. Can't display png
  5. Rendering of graphs in R kernel Notebooks on GitHub (relevant to Github)

推荐答案

我遇到了完全相同的问题.我关闭了Anaconda,再次将其打开,然后更新了内核.最终,它再次正常运行,没有任何错误.

I had exactly the same issue. I closed Anaconda, opened it again and then updated the kernel; Finally, it worked again without any error.

conda install -c r r-essentials

这篇关于jupyter中的r图-无法启动png()设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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