sankey-diagram

Sankey bar graphs in R

心已入冬 提交于 2019-12-23 01:36:10
问题 I'd like to make this type of plot in R. There's more detail on the SAS macros to produce this example here: http://www.pharmasug.org/proceedings/2015/DV/PharmaSUG-2015-DV07.pdf Does anyone have any thoughts on how I should go about doing this in R? NOTE: I know how to make standard sankey diagrams with the D3 or google libraries. This question is specifically about the combination of bar graph and sankey diagram that the SAS macros produce. 回答1: Use the library(flipPlots), using the

Change Font Size on rCharts Sankey Diagram

旧时模样 提交于 2019-12-22 11:27:13
问题 I'm using the following code to create a Sankey Diagram using rCharts. I wish to increase the font size of the text printed on the Sankey Diagram. I can't find a manual to show me how to do this. Thoughts? rm(list = ls()) require(reshape) require(rCharts) require(rjson) target <- c('TMF', 'TMF', 'TMF','Evaporation','Mill Reclaim','Void Losses','Seepage') source <- c('Precipitation & Run Off','Slurry','Other','TMF','TMF','TMF','TMF') value <- c(638,1610,755,118,1430,466,2) x <- data.frame

Change Font Size on rCharts Sankey Diagram

ⅰ亾dé卋堺 提交于 2019-12-22 11:26:24
问题 I'm using the following code to create a Sankey Diagram using rCharts. I wish to increase the font size of the text printed on the Sankey Diagram. I can't find a manual to show me how to do this. Thoughts? rm(list = ls()) require(reshape) require(rCharts) require(rjson) target <- c('TMF', 'TMF', 'TMF','Evaporation','Mill Reclaim','Void Losses','Seepage') source <- c('Precipitation & Run Off','Slurry','Other','TMF','TMF','TMF','TMF') value <- c(638,1610,755,118,1430,466,2) x <- data.frame

Problems while reproducing Sankey chart example with d3_sankey

て烟熏妆下的殇ゞ 提交于 2019-12-22 04:49:13
问题 I am trying to reproduce simple example with rCharts library to plot sankey chart. I found this example from scratch and tried to reproduce it, however, I came up with some problems. Firstly I have tried running this code without nothing. Then I found out and realized, that I need d3_sankey in my computer. So, I have downloaded it from here and copied to C:\Users\adomas\Documents\R\win-library\3.0\rCharts\libraries\widgets\d3_sankey . Then I've tried that unchanged code once more and still

Put line break in node labels in networkD3 sankey diagram

瘦欲@ 提交于 2019-12-21 07:47:08
问题 ++++++++++++++++ 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 labels for a sankey diagram produced using the networkD3 R package? Borrowing the example from Place text values to right of sankey diagram I can add values to the lables: library(networkD3) library(data.table) set.seed(1999) links <- data.table(

D3 Sankey chart using circle node instead of rectangle node

谁说我不能喝 提交于 2019-12-20 12:39:28
问题 I want to use Sankey chart but with circle's instead of rectangles. I am following the example from Mike Bostock. I changed the code there to use circle by setting radius, but how to place the lines connecting nodes around circle. Any clue. Thanks. 回答1: first of all, I would like to tell you that I liked your idea. I will walk you through several simple steps needed to get a decent Sankey diagram with circles. The final result may not be ideal for your application, but I guess it may be

Fixing the order of a Sankey flow graph in R / networkD3 package

家住魔仙堡 提交于 2019-12-19 09:32:10
问题 I would like to visualize a rank change (i.e. change of the relative order) of US states using a Sankey flow graph. I'm using the networkd3 package and came up with the following: library(dplyr) library(networkD3) df <- data_frame(origins=state.name[1:10], destinations=state.name[1:10]) lab <- c(df$origins, df$destinations) nodes <- data.frame(node=c(0:9), name=lab) links <- data.frame(source=c(0:9), target=c(10:19), value=rep(1,10)) sankeyNetwork(Links = links, Nodes = nodes, Source =

Fixing the order of a Sankey flow graph in R / networkD3 package

你离开我真会死。 提交于 2019-12-19 09:30:15
问题 I would like to visualize a rank change (i.e. change of the relative order) of US states using a Sankey flow graph. I'm using the networkd3 package and came up with the following: library(dplyr) library(networkD3) df <- data_frame(origins=state.name[1:10], destinations=state.name[1:10]) lab <- c(df$origins, df$destinations) nodes <- data.frame(node=c(0:9), name=lab) links <- data.frame(source=c(0:9), target=c(10:19), value=rep(1,10)) sankeyNetwork(Links = links, Nodes = nodes, Source =

How to color groups in networkD3's sankeyNetwork?

[亡魂溺海] 提交于 2019-12-19 03:56:39
问题 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 = data$links, Nodes = data$nodes, Source= "source", Target = "target", Value = "weight", NodeID = "names", fontSize = 15, NodeGroup = "group" )) Here's the output I'm getting: 回答1: The NodeGroup vector in the Nodes data frame needs to be non-numeric. That

d3 Sankey - Is it possible to affect or decide the placement of nodes?

你离开我真会死。 提交于 2019-12-19 03:12:14
问题 I'm working with the Sankey plugin for d3.js. Is there a way to affect the automatic placement of the nodes? If you compare the below 2 images. Automatically generated Sankey Diagram: https://files.secureserver.net/0s3DEU5s3OZtqL After I have manually re-arranged it: https://files.secureserver.net/0sYJF1w7f54wdF You see that the nodes are aligned centered after each other which make it hard to use the diagram until you manually rearrange the nodes. Can I affect this flow somehow - or is it