【问题标题】:Save a sankey diagram as svg using riverplot使用 Riverplot 将 sankey 图保存为 svg
【发布时间】:2018-10-25 03:21:23
【问题描述】:

在谷歌网站 (https://developers.google.com/chart/interactive/docs/gallery/sankey) 和社区的帮助下,我使用 riverplot 包创建了一个桑基图。 我现在对图表非常满意,并希望将其保存为 .svg,但是我无法在 R 中找到代码来保存它。 有谁知道怎么做?

非常感谢您的帮助。

这是我的代码:

df <- my data
colors_node <-    c('green','blue','red','yellow','brown','orange','darkviolet',
'grey','navy','aquamarine','darkgreen','firebrick')
colors_node_array <- paste0("[", paste0("'", colors_node,"'", collapse = ','), "]")
opts <- paste0("{
    iterations: 0,
    link: { color: { stroke: 'black', strokeWidth: 1 } },
    node: { colors: ", colors_node_array ,",
           label: { fontName: 'Arial',
                     fontSize: 8,
           color: '#871b47',
           bold: true,
           italic: true }} 
    }" )

plot(
   gvisSankey(df, from="origin", 
         to="visit", weight="weight",
         options=list(
           height=400, width = 300,
           sankey=opts
         ))
 )

我也尝试使用在线软件来转换创建的 html 文件(比如这里:Can I export part of an HTML page to an SVG image?),但我认为由于交互性,这是不可能的

【问题讨论】:

    标签: r riverplot


    【解决方案1】:

    我正在寻找保存由 https://developers.google.com/chart/interactive/docs/gallery/sankey 直接嵌入 JavaScript 的 HTML 代码创建的 Google Sankey 图

    然后,http://www.hiqpdf.com/demo/ConvertHtmlToSvg.aspx 为我管理了它,只需将 html 代码复制到网站,我就可以下载可视化的 svg 版本

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-10
      • 2018-07-02
      • 1970-01-01
      相关资源
      最近更新 更多