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
0
votes
1 answer

R - networkD3 issues

I am using networkD3 in R to display my data (sankeyNetwork function). I ran into several issues that do not seem to have solutions available. Issue 1: If node names similar, the same color is used, even though in total, they differ e.g. if the…
Ferdi
  • 81
  • 7
0
votes
0 answers

R sankeyNetwork d3.scaleOrdinal() - why the colors of the last two nodes do not change

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 <-…
0
votes
1 answer

Is there a way to format plotly Sankey Diagram display?

I am creating a Sankey diagram with plotly as follows: import plotly.graph_objects as go fig = go.Figure(data=[go.Sankey( valueformat = ".0f", valuesuffix = " %", orientation = "h", node = dict( pad = 20, …
0
votes
2 answers

Making an alluvial/sankey diagram using the first axis as the fill

I have this data: https://docs.google.com/spreadsheets/d/18sTSOzVEmSEI2KGfGSvRT_0BbzQ9n87kCGZH-cSULCs/edit?usp=sharing (put below the code to produce it) I use this code: library(ggplot2) library(ggalluvial) ggplot(data = modechoice, aes(y =…
Victor Nielsen
  • 443
  • 2
  • 14
0
votes
0 answers

Holoviews Sankey graph labels not set when nodes are more than edges

I am using a python dataframe to collect data required for my Holoviews Sankey before creating the graph. I need specific labels for the nodes. The below works fine (as long as the number of edges >= number of nodes) import pandas as pd import…
Redox
  • 9,321
  • 5
  • 9
  • 26
0
votes
1 answer

How to print a htmlwidgets::onRender() title added to a Sankey diagram Network D3 in rmarkdown pdf

I have crated this Sankey diagram based on the networkD3::sankeyNetwork() package. I have added the column names based on this post How to add columnn titles in a Sankey chart networkD3 . However, when I knit it into a pdf file, it does not capture…
0
votes
2 answers

Isolating a "branch" in a sankey diagram using networkd3

I am using sankeyNetwork() from the networkD3 package for visualizing some data. I was wondering if theres a way to "isolate" a branch from start to finish, ignoring the irrelevant links. Example: I've got this: SankeyGot And I want to extract this:…
Christian
  • 23
  • 4
0
votes
1 answer

Change color of plotly label

So I have a pretty basic Sankey plot pretty similar to the one in the documentation: import plotly.graph_objects as go fig = go.Figure(data=[go.Sankey( node = dict( pad = 15, thickness = 20, line = dict(color = "black", width…
Tarique
  • 463
  • 3
  • 16
0
votes
1 answer

pandas- how to calculate the percentage for each sankey nodes

I exported some raw data from splunk, and I have transform the raw data to source, target and value based on dc, customer and companyID column by using python pandas, Below is part of sample data. dc,customer,companyID,source,target,value I am…
peace
  • 299
  • 2
  • 16
0
votes
1 answer

R networkD3 sankey - change the colors for all links to blue

Here is example code that I use to make a Sankey chart using networkD3::sankeyNetwork() library("networkD3") a <- read.csv(header = TRUE, text = " date,Data Center,Customer,companyID,source,target,value ") node_names <-…
peace
  • 299
  • 2
  • 16
0
votes
1 answer

R plotly sankey - how to make the column annonation aligned with each column

I have below code, which is to add annonation for each column in the sankey chart. library("plotly") library("ggplot2") library("dplyr") library("xml2") library("htmlwidgets") a <- read.csv(header = TRUE, text = "date,Data…
peace
  • 299
  • 2
  • 16
0
votes
1 answer

plotly r sankey add_trace

i am reading the document https://plotly.com/r/reference/sankey/, and want to change the links color for a sankey chart. But i can't quite understand the parameters in add_trace() function where should i specify the color…
peace
  • 299
  • 2
  • 16
0
votes
1 answer

R Plotly Sankey - link with same soure and target looks like broken, and even color is different when large dataset

I have some user behavior data, and convert the raw data into source, target and value format, in order to draw a sankey chart of user behavior flow, and then displayed and filtered in powerBI. raw data contains below columns: Below is a piece of…
peace
  • 299
  • 2
  • 16
0
votes
1 answer

`ggalluvial`: `geom_flow` fill color from destination stratum

I have the following example: library(tidyverse) library(ggalluvial) data <- tibble(id = paste0("S", 1:20), class_1 = c(rep("A", 10), rep("B", 10)), class_2 = c(rep("A", 8), rep("B", 8), rep("A", 4))) data_pvt <- data %>% …
csgroen
  • 2,511
  • 11
  • 28
0
votes
0 answers

anyone successfully generate sankey chart with R plotly in powerBI desktop and powerBI service?

I tried by best to create sankey chart with R plotly package in powerBI, but failed. I can create sankey in RStudio with same code. I checked the official document that the package 'plotly' i used is supported by powerBI service. So there should be…
peace
  • 299
  • 2
  • 16