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
4
votes
0 answers

Create Sankey diagram with ggforce that skips nodes

I would like to use the ggforce package in R to create a Sankey diagram because I prefer the look of the parallel sets plots made with ggforce to other visualizations. I have nodes that are sorted into levels from left to right. However I want some…
qdread
  • 3,389
  • 19
  • 36
4
votes
0 answers

Sankey diagram, alluvial, ggalluvial in R – Three data blocks: Baseline-Flow (many time points)-Outcome

We would like to present the change in muscle mass due to the exercise of different age group and the final performance/outcome at the competition at the end of the study. We have several time points at which the muscle mass was measured. In this…
Niels
  • 141
  • 12
4
votes
1 answer

Removing "unused" nodes in sankey network

I am trying to build a sankey network. This is my data and code: library(networkD3) nodes <- data.frame(c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "D", "E", "N", "O", "P", "Q", "R")) names(nodes) <- "name" nodes$name =…
Florian Seliger
  • 421
  • 4
  • 16
4
votes
1 answer

Sankey network manual colour change

I am trying to build sankey plot using networkD3 library. I have following code and data: # Plotting the Sankey network diagram nodes = data.frame("name" = c("Mamalian", # Node 0 "Avian", # Node 1 …
4
votes
2 answers

Data preparation for Sankey Data in R to get flow frequency

I have tried to create a Sankey Diagram using both the ggalluvial and networkd3 packages and failed to date. Ideally I would like to understand how to get what I want to do in both. Data is generated as follows: dat <- data.frame(customer =…
user1420372
  • 2,077
  • 3
  • 25
  • 42
4
votes
1 answer

Sankey bar chart diagramm with pandas or python

I would like to make a barchart diagramm like this one with any python module that I can interface with matplotlib: Below is an example data and an explanation of what I can do as for now: import pandas from io import StringIO text=""" Name …
baloo
  • 517
  • 1
  • 5
  • 13
4
votes
2 answers

Pandas Create Link Pairs from Multiple Rows

I have a df with id as the flow id, dttm as the step modification time, and step as the steps in the flow. It is currently ordered by dttm. There could be any number of steps for a particular id. Current df: id dttm step 0 …
OverflowingTheGlass
  • 2,324
  • 1
  • 27
  • 75
4
votes
0 answers

How to color two links coming out of the same node (or going to the same node) with different colors using gvisSankey?

I am creating a Sankey diagram using googleVis in R. I want to to color links of nodes that "advance" in one color, links of nodes that "regress" in another, and links of nodes that "stay the same" in a third color. For example: A1 -> B3 means…
Raul Torres
  • 187
  • 1
  • 6
4
votes
0 answers

Gradient color in links of sankey chart using networkD3

I am using networkD3 to create sankey diagrams in R. I am using something like below to generate the diagrams: sankeyNetwork(Links = data$links, Nodes = data$nodes, Source = "source", Target = "target", Value = "value", NodeID = "name", …
Sayan Pal
  • 4,768
  • 5
  • 43
  • 82
4
votes
1 answer

Change node colors in d3 Sankey Diagram based on additional column in data

I am creating a Sankey Diagram using the D3 Sankey plugin. I have the standard columns: source, target, value plus one additional column called nodeColor. I would like the color of the target node to be dictated by the color noted in the…
Danny
  • 554
  • 1
  • 6
  • 17
4
votes
2 answers

Assigning node and link colors in R googleVis sankey chart

Picking up on this question, I'm trying to assign a set of colours to nodes, and hopefully links with the gradient mode, in a Sankey chart using GoogleVis package in R. The issue is that I have the same categories in each of the 3 sets of nodes, and…
Phil
  • 7,287
  • 3
  • 36
  • 66
4
votes
0 answers

How to move starting node in D3 googleVis Sankey graph

I have drawn a Sankey graph in D3 using the googleVis. But I want to reposition the nodes on the x-axis based on the number in the name of the node. i.e Right now all starting nodes appear on the left side, and they end on the right side. I want…
SharpObject
  • 597
  • 5
  • 17
4
votes
2 answers

How to color groups in networkD3's sankeyNetwork?

My nodes consists of names and groups yet I can't seem to implement distinct colors for groups in my sankey diagram. The colors are either all blue with defaults or all black using the code below. Here's the code I use: sankeyNetwork( Links…
JnrfL
  • 189
  • 2
  • 8
4
votes
4 answers

Sankey Diagram with networkD3 package will not plot

I am using the sankeyNetwork function in the networkD3 package in R using as an example the code found here. However, all I get is a blank screen. The diagram is supposed to show the flow of infections between age groups (by gender). My code is as…
Tumaini Kilimba
  • 195
  • 2
  • 15
4
votes
2 answers

Connecting flows in matplotlib sankey diagram

I am using matplotlibs sankey functionality and have a problem with connecting two flows. Basically, I just want to connect the flow Qab,rekup to the end of the flow Qzu,rekup (see Screenshot). Seems to be quite easy but I still haven't figured out…
Cord Kaldemeyer
  • 6,405
  • 8
  • 51
  • 81