Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 使用ggplot2、plotly和ggplotly创建Sankey图_Json_R_Ggplot2_Plotly_Ggplotly - Fatal编程技术网

Json 使用ggplot2、plotly和ggplotly创建Sankey图

Json 使用ggplot2、plotly和ggplotly创建Sankey图,json,r,ggplot2,plotly,ggplotly,Json,R,Ggplot2,Plotly,Ggplotly,我想使用ggplot2和plotly创建sankey图表,并使用ggplotly调用。我需要一些很好的工作示例和一些关键的链接。我已经在plotly中实现了一个,这就是我实现的快照。请帮忙,谢谢 编辑脚本: library(googleVis) datSK <- data.frame(From=c(rep("r1","r2","r3","r4","r5","r6","r7")), To=c(rep(c("Blood Test", "Check Out", "Di

我想使用ggplot2和plotly创建sankey图表,并使用ggplotly调用。我需要一些很好的工作示例和一些关键的链接。我已经在plotly中实现了一个,这就是我实现的快照。请帮忙,谢谢

编辑脚本:

library(googleVis)
datSK <- data.frame(From=c(rep("r1","r2","r3","r4","r5","r6","r7")),              
To=c(rep(c("Blood Test", "Check Out", "Discuss Results","MRI SCAN",
                           "Registration","Triage and Assessment","XRay"))),
Weight=c(237,492,495,236,500,500,261))
Sankey <- gvisSankey(datSK, from="From", to="To", weight="Weight",
                 options=list(
                   sankey="{link: {color: { fill: '#d799ae' } },
                        node: { color: { fill: '#a61d4c' },
                        label: { color: '#871b47' } }}"))
plot(Sankey)
library(googleVis)

datSK这个问题现在已经非常老了,这个答案当时还不存在,但是ggforce包现在允许在ggplot中绘制sankey图。目前没有ggplotly支持(因此也没有可交互性),但对于简单的sankeys,它现在是我发现的最好的选择,因为它可以与tidy data framework一起工作。

您尝试过。。。谷歌?您确实需要提供更多信息,并进行第一次尝试,让我们知道哪些不起作用。感谢您的回复,请查看编辑,我还需要一个onclick函数,它可以帮助我单击行并查看数据。@RemkoDuursma,请在Sankey中帮助我满足此要求,我需要帮助哪个ggforce函数实现Sankey?我在参考资料中找不到。它们在包中称为并行集,您可以在这里看到一个示例。我只使用过一次,但是如果你的数据是正确的格式,它们似乎可以很方便地工作。