如何以高质量从情节中导出图作为静态图像?

发布于 2025-02-08 17:51:02 字数 275 浏览 2 评论 0原文

对于可视化部分,我将ggplotly和下一个编织我的标记文件编织到HTML中。 接下来,当我想从Plotly输出下载静态图像时,PNG文件的质量非常低。因此,我想知道是否有一种方法可以提高Plotly中可下载的静态图像的质量?

For the visualization part, I use ggplotly and next knit my markdown file into HTML.
Next, when I want to download a static image from plotly output, the quality of the PNG file is very low. So, I wonder if there is a way to increase the quality of downloadable static images in plotly?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫南 2025-02-15 17:51:02

创建绘图对象时,可以修改模式栏。 (您还可以稍后再添加更改。)您可以看到有关 modebar的更多选项。 >。

例如:

library(plotly)
data(gapminder, package = "gapminder")

plot_ly(data = gapminder, x = ~continent, y = ~lifeExp, 
        type = "bar") %>% 
  config(
    toImageButtonOptions = list(
      format = "svg",
      filename = "myplot",
      width = 600,
      height = 700
    )
  )

You can modify the mode bar when you create a Plotly object. (You can add the change later, as well.) You can see more options regarding the modebar here.

For example:

library(plotly)
data(gapminder, package = "gapminder")

plot_ly(data = gapminder, x = ~continent, y = ~lifeExp, 
        type = "bar") %>% 
  config(
    toImageButtonOptions = list(
      format = "svg",
      filename = "myplot",
      width = 600,
      height = 700
    )
  )
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文