r sankeynetwork d3.scaleordinal() - 为什么最后两个节点的颜色不变
我正在手动在Sankey图中手动更改条形的颜色,但是对于最后三个类别,颜色不会根据新的Color_Scale和“黄色”分配给最后三个类别的所有类别。
''
color_scale <- 'd3.scaleOrdinal().
range(["gainsboro","dimgray", "black" ,
"darkred","red","tomato", "lightsalmon",
"royalblue","blue", "midnightblue", "deepskyblue",
"yellow", "green","red"])'
sankeyNetwork(Links = resparking$links, Nodes = resparking$nodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
units = "Number of Houses",
fontSize = 20, nodeWidth = 30,
colourScale = JS(color_scale))
'''
可以在此处下载数据: https://drive.google.com/file/d/1hpq-pvw89hsvylrla0anqdfb-orjbjiz/view?usp = sharing
图形和数据看起来像这样: [在这里输入图像描述] [1] [1]:https://i.sstatic.net/2eqaf.png
I am working on manually changing the color of the bars in a sankey diagram, but for the last three categories, the colors do not vary according to the new color_scale and "yellow" is assigned to all of the three last categories.
'''
color_scale <- 'd3.scaleOrdinal().
range(["gainsboro","dimgray", "black" ,
"darkred","red","tomato", "lightsalmon",
"royalblue","blue", "midnightblue", "deepskyblue",
"yellow", "green","red"])'
sankeyNetwork(Links = resparking$links, Nodes = resparking$nodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
units = "Number of Houses",
fontSize = 20, nodeWidth = 30,
colourScale = JS(color_scale))
'''
The data can be downloaded here: https://drive.google.com/file/d/1hPq-PvW89hsVylrLA0anqDFB-OrjBJIz/view?usp=sharing
The graph and data look like this:
[enter image description here][1]
[1]: https://i.sstatic.net/2EqAF.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论