Questions tagged [sankey-diagram]

Sankey diagrams are a kind of flow diagram, in which the width of the arrows is shown proportionally to the flow quantity. They are typically used to visualize energy or material or cost transfers between processes.

752 questions
92
votes
10 answers

Sankey Diagrams in R?

I am trying to visualize my data flow with a Sankey Diagram in R. I found this blog post linking to an R script that produces a Sankey Diagram; unfortunately, it's quite raw and somewhat limited (see below for sample code and data). Does anyone know…
Eric Fail
  • 8,191
  • 8
  • 72
  • 128
26
votes
1 answer

How to define the structure of a sankey diagram using a pandas dataframe

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…
vestland
  • 55,229
  • 37
  • 187
  • 305
24
votes
2 answers

How to change default order of nodes in a sankey diagram

I created a Sankey diagram using the plotly package. As far as I see, the default order of nodes is mostly defined by the value. However, I want the alphabetical order without manually moving nodes with mouse drug. Can I change the default…
cuttlefish44
  • 6,586
  • 2
  • 17
  • 34
23
votes
2 answers

Sankey diagram transition

I would like to know if there is an easy way to modify the Sankey diagram example so that there is smooth transition to new data. For example, imagine I have different datafiles (energy1.json, energy2.json ...) how could d3 plot a Sankey diagram for…
Mermoz
  • 14,898
  • 17
  • 60
  • 85
16
votes
1 answer

Plotly: How to draw a sankey diagram from a dataframe?

I have a dataframe: Vendor Name Category Count AKJ Education Books 846888 AKJ Education Computers & Tablets 1045 Amazon Books …
user517696
  • 2,472
  • 7
  • 24
  • 35
16
votes
7 answers

Sankey diagram in javascript

I want to draw a Sankey diagram using Javascript. Can anyone provide some direction regarding the algorithms or libraries that are available for this?
321zeno
  • 1,264
  • 1
  • 12
  • 24
16
votes
1 answer

Gradient along links in D3 Sankey diagram

Here is jsfiddle of a Sankey diagram: I am trying to modify colors of the links so that the color of each link is actually gradient from its source node color to its target node color. (it is assumed that opacity will remain 0.2 or 0.5 depending…
VividD
  • 10,456
  • 6
  • 64
  • 111
15
votes
1 answer

How to Specify Node Label Position for Sankey Diagram in Plotly

I am trying to figure out if there is a way to specify the location of the node's labels for a Plotly Sankey diagram in python. In the image linked below I have the diagram with the labels automatically to the right of each node, however I am trying…
14
votes
2 answers

Highlight all connected paths from start to end in Sankey graph using R

I want to highlight the whole path when i click on the node to know the whole story of specific node and here's an example- http://bl.ocks.org/git-ashish/8959771 . Please check this link and you will find the function that highlight the path in…
14
votes
1 answer

Put line break in node labels in networkD3 sankey diagram

++++++++++++++++ Update: I think the answer to my question is that you can't put line breaks in. A colleague pointed out to me the node labels are SVG blocks, which don't support line breaks. ++++++++++++++++ How do I put a line break into the node…
edsherman
  • 141
  • 4
14
votes
5 answers

Sankey diagrams in Python

Is there a Python library for generating Sankey diagrams? I've seen this list of Sankey diagram applications and libraries, but none of them is in Python.
nazca
  • 340
  • 1
  • 2
  • 10
13
votes
1 answer

Modify networkD3 sankey plot with user-defined colors

I have a sankey plot created in networkD3 package. I would like to modify the colors and transparency of both nodes and links. My data networkD3_data is appended at the end. Question 1: How to modify node colors with user-defined palette? I am not…
Djork
  • 3,319
  • 1
  • 16
  • 27
13
votes
6 answers

d3 sankey charts - manually position node along x axis

A problem I have come across using the d3 sankey implementation is that there's no way to specify where on the x axis a node is. I've been poking through the source and there isn't really a "clean" way to specify the x value on a reasonable scale…
Seiyria
  • 2,112
  • 3
  • 25
  • 51
12
votes
2 answers

R Highcharter Sankey nodes column property trouble

I want to plot a Sankey diagram in R using highcharter package. I face a problem with formatting it. Here is the example. # devtools::install_github("jbkunst/highcharter") library(highcharter) hc_dat <- data.frame(from = c("A", "A", "B"), …
inscaven
  • 2,514
  • 19
  • 29
11
votes
1 answer

Controlling Sankey diagram connections

I'm trying to control which flows connect to each other using the Matplotlib Sankey diagram. I'm modifying the basic two systems example. I think my confusion comes down to misunderstanding what this actually means: Notice that only one connection…
Ben
  • 12,614
  • 4
  • 37
  • 69
1
2 3
50 51