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
1
vote
0 answers

sankeyNetwork add legend of link width value in R

I have created a sankey chart to display the statistically significant relationships between my nodes and path. The connector line width indicates de (log10)P-value of each interaction, i.e. the wider the line the higher the (log10)P-value. I would…
1
vote
0 answers

Is there a way to display the names of all nodes in a Highchart sankey diagram in R?

I'm currently using the R package highcharter to create a simple Sankey diagram from a data set describing funding for multiple projects. The Sankey is quite simple: it has nodes for Funders, nodes for Projects, and flows weighted by annual…
1
vote
1 answer

Scraping data from sankey diagram using python and BS

I am new to Python and am currently trying to figure out how to scrape data from this web: https://www.iea.org/sankey/#?c=Indonesia&s=Balance i have tried using BS and selenium but it didnt work. Need data that showed inside the diagram. Thank you…
Bagas
  • 13
  • 2
1
vote
1 answer

Prepping data for sankey plot in plotly

I have a data as follows: df = pd.DataFrame({'Id': [1, 2, 3, 4], 'ColA': [30, 20, 20,30], 'ColB':[50, 20, 30,70], 'ColC':[70, 30, 20,80]}) I want to prepare this for a sankey plot using plotly. I am not sure how to do the same. What I want to plot…
Uqhah
  • 57
  • 11
1
vote
0 answers

How do I move labels to each bar horizontally to the left and move values to the top of Sankey graph using ggplot in R

I want to have my label each of my bars (horizontally) from my legend. I also want to move my value labels to the top of the graph instead of the bottom. below is my code and a picture of the plot. ggplot(data= AZD.melt, aes(x = variable, y…
ElHombre
  • 23
  • 4
1
vote
1 answer

How to make a stacked Sankey diagram using ggplot in R?

I have this data and I want to create a stacked Sankey Diagram using ggplot. I want to try and recreate it and look like the following picture. What's the best way to go about it? Risk Factors for Stroke 1990 1995 2000 2005 …
ElHombre
  • 23
  • 4
1
vote
0 answers

How to add value on sankey links with plotly on python

I have a sankey plot using plotly but I do not managed to display values on links (only on the hover toolbox). In In R, how to display value on the links/paths of Sankey Graph? they add custom code to do so in R but I was not able to reproduce it in…
1
vote
0 answers

How to pre-position sankey nodes in plotly?

I started using plotly to draw sankey charts. I want to display a multi year series with birth and death year by year. The current code looks like: ` import plotly.graph_objects as go fig = go.Figure(data=[go.Sankey( node = dict( pad =…
Carl Brenz
  • 11
  • 3
1
vote
1 answer

How to create individual node and link colours in Sankey graph

I am making a Sankey graph and want to colour the nodes and links individually (ideally having the links the same colour as the source node). I've researched on various forums and put together the following code for the colours. However, all I get…
Paul
  • 13
  • 3
1
vote
1 answer

Python: transforming complex data for a Sankey plot

I am trying to produce a Sankey plot of the events that take one week before and one week after an index event of a patient. Imagine I have the following data frame: df = patient_id start_date end_date Value Index_event_date…
Economist_Ayahuasca
  • 1,648
  • 24
  • 33
1
vote
1 answer

Why is line going through node in Sankey diagram in plotly Python?

Line of Sankey diagram is going through one of the nodes while it should be seperate like all the other ones. Any idea why this is happening or how to prevent this? fig = go.Figure(data=[go.Sankey( node = dict( pad = 100, thickness = 30, …
1
vote
1 answer

Can you change font of labels in plotly sankey diagrams?

I can't find a way to change the font size or colors of the labels (source and target names, not the title) in the Sankey diagram of plotly. Is this even possible? In the example below: change font size of fe "Steam 8 MW" import plotly.graph_objects…
1
vote
0 answers

Automatically calculating a value from a Pandas dataframe column and assigning the value to a list for a Plotly Sankey Chart

I am trying to automate the creation of a Sankey diagram in Plotly. I can generate it statically when I provide the values in a dataframe as shown below. What I really want to do is automatically calculate these values on the fly with in the…
twelsh37
  • 189
  • 3
  • 13
1
vote
0 answers

Create shiny app with selected Sankey node and links

Following up with this question, how can I create an shiny app in which I can choose a person and get nodes and links related to that person only shown?. The data plot and code I tried are below: Data df <- read.table(header = TRUE, stringsAsFactors…
Lily Nature
  • 613
  • 7
  • 18
1
vote
1 answer

Network D3 Sankey Node Value too Precise Using Htmlwidgets

I added the node label with its name and value to a network D3 Sankey in R using a javascript as follows: javascript_string <- 'function(el, x){ d3.select(el).selectAll(".node text") .text(d => d.name + " (" + d.value + ")"); }' The…