【问题标题】:How to get high-resolution plots in a Jupyter notebook using the R kernel?如何使用 R 内核在 Jupyter 笔记本中获得高分辨率绘图?
【发布时间】:2017-08-24 16:24:41
【问题描述】:

在带有 R 内核的 Jupyter 笔记本中使用 SVG 会破坏文本。请参阅 herehere。解决方法是使用 PNG。有点模糊。在 Python 中,您可以要求 PNG 渲染器使用更多的每英寸点数

 InlineBackend.figure_format = 'retina'

参见例如trick 15 here

如何使用 R 内核获得更高分辨率的绘图? SVG 解决方法? PNG 渲染器设置?

编辑:我在 R 中使用 ggplot。

编辑 2:我发现 repr.plot 默认为 here,包括分辨率,看起来是每英寸点数 (dpi)。然而,当我将res 从 120 提高到 300 时,尽管我设置了高度和宽度,但情节变得更大。

编辑 3:我提交了 this issue。有关于如何在代码中修复它的建议,但没有解决方法。

【问题讨论】:

  • 那么,有什么更新吗?

标签: r jupyter-notebook


【解决方案1】:

我最近发现 packages : plotly 可以很好地创建 ggplot 图像

试试 plot_ly() 函数来保存 png 图片

here is a demo using plot_ly

希望这能有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-23
    • 1970-01-01
    • 2017-12-21
    • 2016-01-06
    • 2016-12-04
    • 2017-09-30
    • 2022-07-21
    相关资源
    最近更新 更多