plotly-sankey | Examples using Plotly to build Sankey Diagrams | Data Visualization library
kandi X-RAY | plotly-sankey Summary
kandi X-RAY | plotly-sankey Summary
Examples using Plotly to build Sankey Diagrams
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of plotly-sankey
plotly-sankey Key Features
plotly-sankey Examples and Code Snippets
Community Discussions
Trending Discussions on plotly-sankey
QUESTION
I am trying to create a Sankey chart in a Jupyter notebook, basing my code on the first example shown here.
I ended up with this, which I can run without getting any errors:
...ANSWER
Answered 2018-Feb-09 at 16:12I have had similar issues with plotly offline in Jupyter in the past - sometimes it's surprisingly inconsistent when/why the plots fail to appear. It may be worth a try starting with an increased data rate limit.
jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10
QUESTION
This may sound like a very broad question, but if you'll let me describe some details I can assure you it's very specific. As well as discouraging, frustrating and rage-inducing.
The following plot describes a scottish election and is based on code from plot.ly:
Plot 1:
Dataset 1:
...ANSWER
Answered 2019-Mar-27 at 16:53This problem looks really strange, but only until you will analyze how the sankey plot in plotly
is created:
When you create the sankey plot, you send to it:
- Nodes list
- Links list
These lists are bounded with each other. When you create the 5-length node list, any edge will know about 0,1,2,3,4
in its starts and ends. In your program, you creates node wrongly - you create the list of links and then go through it and create nodes. Look at your diagram. It has two black nodes with undefined
inside. And what is the length of your dataset... Yes, 5
. Your node indices ends on 4
and no target nodes are really defined. You add the sixth list in your dataset and - bingo! - there are nodes[5]
exists! Just try to add another new line in your dataset:
[1,7,1,'#FF0000','WAKA','rgba(219, 233, 246,0.5)']
And you will see that another black bar is colored to red. You have five nodes (because you have 5 links and you create node by iterating for links list), but links target indices are 5,6,7
. You can fix it with two ways:
- Change
Target
's in your dataset to2,3,4
- Create nodes and links separately (right way)
I hope I helped you in your problem and in plot creation understanding (what is more important IMO).
Edit: Here is the example of separate nodes/links creation (note that node
part in data_trace
uses only nodes_df
data, link
part in data_trace
uses only links_df
data and nodes_df
and links_df
length are not equal):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install plotly-sankey
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page