在谷歌(https://developers.google.com/chart/interactive/docs/gallery/sankey)的网站和这里的社区的帮助下,我使用riverplot包创建了一个Sankey图。我现在对这个图形非常满意,我想将它保存为.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?),但我认为由于交互性,这是不可能的
发布于 2018-05-25 05:40:15
我正在寻找保存Google Sankey Diagram创建的直接从https://developers.google.com/chart/interactive/docs/gallery/sankey的JavaScript嵌入式超文本标记语言代码
然后,http://www.hiqpdf.com/demo/ConvertHtmlToSvg.aspx只需将html代码复制到网站上,我就可以下载svg版本的可视化效果
https://stackoverflow.com/questions/50347701
复制相似问题