networkd3

Shiny App-showModal does not pop up with renderSankeyNetwork

青春壹個敷衍的年華 提交于 2019-12-08 07:50:50
问题 I am developing a Shiny application which has two components Sankey Diagram and one action button which pop up "SaveMsg" dialog box on click of button . I am seeing unexpected behavior where, If I user actionbutton and Sankeyvisualization in one dashboard, on click of action button, dashboard screen greyed out. however If I comment Sankey code and keep only Action button on UI, Action button works as expected by showing pop up message of "save successfull". If I comment action button code and

Sankey diagram for Discrete State Sequences in R using networkd3

荒凉一梦 提交于 2019-12-08 05:29:59
问题 I am trying to create an interactive Sankey diagram in R using the networkD3 package as described at http://christophergandrud.github.io/networkD3/#sankey. My data is in the format of Discrete State Sequences(DSS). 1 row represents 1 event sequence. NAs represent that the sequence has ended. Recreating a sample of the data in R: x1 <- c('06002100', '06002001', '06001304', '06002100') x2 <- c('06002100', '06002001', 'NA', 'NA') x3 <- c('06001304', '06002100', '06002001', 'NA') test <- as.data

Transition (Sankey) plot with time on x axis

故事扮演 提交于 2019-12-08 02:28:58
问题 I have a transition matrix as following: 1. A A B 2. B C A 3. A C C where each column represents periods,each row represents an agent and each letter represents a state. I would like a create a plot such as Sankey Diagram which shows transitions from states to states in each period. Agents' identities are not important. So I would like to have a plot like this: . It seems that I can use networkD3 or googleVis packages. However since the position of each node is endogenously determined by the

How to arrange html widget plots in a grid for export as pdf?

此生再无相见时 提交于 2019-12-07 11:58:28
问题 I would like to combine the richness of html widgets (mainly plotly and networkD3), with the possibility of arranging them as plots in a grid in R, to export them as pdf graphic for a publication. However, if I create some html widget objects in R and try to arrange them with gridExtra::grid.arrange() (see minimal example below) I get the following error: Error in gList(list(x = list(links = list(source = c(0, 0), target = c(1, : only 'grobs' allowed in "gList" I searched for “converting html

How to sort source and/or target nodes in a sankey diagram within a shiny app?

末鹿安然 提交于 2019-12-07 08:30:46
问题 I have a simple sankey diagram, generated using networkD3 package inside a shiny app. How can source and/or target nodes be sorted? As you can see in the MWE, by default, neither source nodes (A, B, C, D, E) nor target nodes (V, W, X, Y, Z) are sorted. At least, sorting is not comprehensible to me. Code: library("shiny") library("networkD3") ui <- fluidPage( column(3), column(6, sankeyNetworkOutput("mySankeyD")), column(3) ) server <- function(input, output) { output$mySankeyD <-

How to control node labels in Sankey diagram

元气小坏坏 提交于 2019-12-06 16:09:03
问题 I have a Sankey diagram I'm creating in R. It produces the diagram but the node names are placed on the left of the nodes for the right side nodes. I would like all names to be on the right so the real names (which are longer) don't overlap with each other. Below is a complete set of working code that will generate the diagram I am currently working with. library(networkD3) nodes <- data.frame('name' = c('Node0','Node1','Node2','Node3','Node4','Node5','Node6', 'Node7','Node8','Node9','Node10'

How to sort source and/or target nodes in a sankey diagram within a shiny app?

你说的曾经没有我的故事 提交于 2019-12-05 18:05:34
I have a simple sankey diagram, generated using networkD3 package inside a shiny app. How can source and/or target nodes be sorted? As you can see in the MWE, by default, neither source nodes (A, B, C, D, E) nor target nodes (V, W, X, Y, Z) are sorted. At least, sorting is not comprehensible to me. Code: library("shiny") library("networkD3") ui <- fluidPage( column(3), column(6, sankeyNetworkOutput("mySankeyD")), column(3) ) server <- function(input, output) { output$mySankeyD <- renderSankeyNetwork({ myDf <- list( nodes=data.frame(name=c( "A", "B", "C", "D", "E", "V", "W", "X", "Y", "Z")),

Adjusting sankey plot in tabbed section

£可爱£侵袭症+ 提交于 2019-12-05 15:44:39
问题 In the r-markdown document given below, I use tabbed sections to display sankey plots. However, when a sankey plot is in a tab other than the first, adjusting (using htmlwidgets::onRender function) does not work. Does anybody know a way to overcome that problem? Related question: How to control node labels in Sankey diagram --- title: "Untitled" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) library(networkD3) library(htmlwidgets) nodes <- data.frame

Specify colors for each link in a force directed network, networkD3::forceNetwork()

被刻印的时光 ゝ 提交于 2019-12-05 07:51:51
The question is to specify two different colors based on the Value or weight of the link using networkD3::forceNetwork in R. For example, Blue for the weight of links more than 1, dark for the weight of links less than 1. Example code, copied from here (the forceNetwork section): library(networkD3) # Load data data(MisLinks) data(MisNodes) # Plot forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source", Target = "target", Value = "value", NodeID = "name", Group = "group", opacity = 0.8) A d3-js related question is here (I know nothing about JS so far). I've just had the same problem

Creating a Sankey Diagram using NetworkD3 package in R

冷暖自知 提交于 2019-12-05 01:22:28
问题 Currently I am trying to create an interactive Sankey with the networkD3 Package following the instructions by Chris Grandrud (https://christophergandrud.github.io/networkD3/). What I don't understand is is table-format, since he just uses two columns for visualising more transitions. To be more specific, I have a dataset containing four columns which represent 4 years. Inside these columns are different hotel names, whereas each row represents one customer, who is "tracked" over these four