networkd3

How to keep a forceNetwork {networkD3} centered in a Shiny app?

徘徊边缘 提交于 2020-01-01 03:31:28
问题 While building a Shiny app that displays a forceNetwork graph, the network does not stay centered but moves out of view when one interactively changes the opacity. My question is, how to change this behavior and keep the network nicely centered as it was initially? A reproducible example: ui.R: library(shiny) library(networkD3) shinyUI(fluidPage( titlePanel("ForceNetD3"), sidebarLayout( sidebarPanel( sliderInput("opacity", "Opacity", min = 0.1, max = 1, value = 0.4) ), mainPanel(

How to keep a forceNetwork {networkD3} centered in a Shiny app?

旧城冷巷雨未停 提交于 2020-01-01 03:31:09
问题 While building a Shiny app that displays a forceNetwork graph, the network does not stay centered but moves out of view when one interactively changes the opacity. My question is, how to change this behavior and keep the network nicely centered as it was initially? A reproducible example: ui.R: library(shiny) library(networkD3) shinyUI(fluidPage( titlePanel("ForceNetD3"), sidebarLayout( sidebarPanel( sliderInput("opacity", "Opacity", min = 0.1, max = 1, value = 0.4) ), mainPanel(

forceNetwork is not zero indexed

試著忘記壹切 提交于 2019-12-31 01:56:09
问题 I am trying to create a simple forceNetwork , but the plot won't render. I keep getting the following warning: Warning message: It looks like Source/Target is not zero-indexed. This is required in JavaScript and so your plot may not render. How do I fix this? Note that simpleNetwork works fine so the problem seems to be in how I am specifying my data. library(igraph) library(networkD3) set.seed(42) temp<-data.frame(source=c(1,2,3,4),target=c(2,3,4,4))#csv[1:500,] links<-data.frame(source=temp

R networkD3 color node stroke for radialNetwork()

旧时模样 提交于 2019-12-30 11:09:20
问题 The networkd3 package contains some very nice functions for creating the obvious networks. Different functions have different arguments, so this questions is specifically in regards to the radialNetwork() function. Is it possible to have the color of the node stroke change according to a given vector? The below code creates a the network graph but changing the argument for the node stroke to a vector containing different colors does not work. library(networkD3) library(tidyverse) library(data

linking a node in networkD3 to a website using clickAction = NULL

房东的猫 提交于 2019-12-30 05:27:17
问题 Is there a way to use a node as a link to an external website using the function forceNetwork() in the networkD3 package in r ? I was thinking maybe modifying the clickAction ? Example data: library(networkD3) data(MisLinks) data(MisNodes) # Create a random URL in the nodes dataset MisNodes$URL <- paste0("http://www.RANDOMLINK_", sample(1:100, NROW(MisNodes)), ".com") head(MisNodes) MyClickScript <- 'alert(d.index)' forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source", Target =

Tiny plot output from sankeyNetwork (NetworkD3) in Firefox

ぐ巨炮叔叔 提交于 2019-12-29 07:01:48
问题 As per object, I get a very small plot in Firefox when using sankeyNetwork() from networkd3 in shiny but not in Chrome or RStudio. I have not included any CSS or JS in the script - the code below produces this result for me. Is there any CSS property I have missed? I am using R 3.4.1, shiny 1.1.0, networkD3 0.4 and Firefox 52.9.0. Firefox: Chrome: library(shiny) library(magrittr) library(shinydashboard) library(networkD3) labels = as.character(1:9) ui <- tagList( dashboardPage(

Highlight all connected paths from start to end in Sankey graph using R

烈酒焚心 提交于 2019-12-28 05:54:21
问题 I want to highlight the whole path when i click on the node to know the whole story of specific node and here's an example- http://bl.ocks.org/git-ashish/8959771 . Please check this link and you will find the function that highlight the path in javscript, but take care please , this function doesn't do what i want, it highlight links related to the clicked node and the links related to the target nodes. what i want is to highlight all links related to the clicked node. d3 Sankey - Highlight

Passing argument to a function in shiny R

匆匆过客 提交于 2019-12-24 08:19:20
问题 I'm trying to pass the node value of a simple network as an argument to a function in Shiny R. However, I'm getting this error: Error in rsqlite_send_query: no such column: input$id Can anyone help with this issue? Thanks. library(shiny) library(networkD3) ui <- shinyUI(fluidPage( fluidRow( column(4, simpleNetworkOutput("simple")), column(4, DT::dataTableOutput("table")) ) )) server <- shinyServer(function(input, output, session) { session$onSessionEnded(stopApp) output$simple <-

Network Analysis - Manipulating data - Shiny

不问归期 提交于 2019-12-24 07:11:33
问题 I'm using the networkD3 package and I'm trying to do some network analysis Let's say I have this data: src <- c("Dizzy Gillespie","Louis Armstrong","Max Roach","Charlie Parker","Charlie Parker") target <- c("Chet Baker","Chet Baker","Peter Erskine","John Coltrane","Wayne Shorter") group <- c("Trumpet","Trumpet","Drums","Saxophone","Saxophone") networkData <- data.frame(src, target,group) I've read this documentation https://christophergandrud.github.io/networkD3/ but they won't tell how they

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

孤人 提交于 2019-12-22 05:23:50
问题 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 =