datastorm-open / visNetwork

R package, using vis.js library for network visualization
Other
545 stars 125 forks source link

Blank visNetwork in RStudio #469

Closed lukebandy closed 5 months ago

lukebandy commented 5 months ago

RStudio: 2024.04.1 R: 4.4.0 visNetwork: 2.1.2

This has been tested on multiple machines all running the same versions.

Attempting to render a visNetwork within RStudio produces a blank output:

library(visNetwork)
nodes <- data.frame(id = 1:10, label = paste("Node", 1:10))            
edges <- data.frame(from = c(1,2,5,7,8,10), to = c(9,3,1,6,4,7))
visNetwork(nodes, edges)

image

When running through Shiny the same network does render:

library(visNetwork)
library(shiny)

ui <- shiny::basicPage(
  visNetworkOutput("network")
)

server <- function(input, output) {
  output$network <- renderVisNetwork({
    nodes <- data.frame(id = 1:10, label = paste("Node", 1:10))             
    edges <- data.frame(from = c(1,2,5,7,8,10), to = c(9,3,1,6,4,7))
    visNetwork(nodes, edges)
  })
}

shinyApp(ui, server)

image

lukebandy commented 5 months ago

Updating R to 4.4.1 seems to have fixed this for us - closing