visNetwork is an R package for network visualization, using vis.js javascript library ( All remarks and bugs are welcome on github :


Based on htmlwidgets, so :

  • compatible with shiny, R Markdown documents, and RStudio viewer

The package proposes all the features available in vis.js API, and even more with special features for R :

  • easy to use
  • custom shapes, styles, colors, sizes, …
  • works smooth on any modern browser for up to a few thousand nodes and edges
  • interactivity controls (highlight, collapsed nodes, selection, zoom, physics, movement of nodes, tooltip, events, …)
  • visualize rpart tree


Package is now available on CRAN.


# can have new features in development version 

How does it work ?

visNetwork needs at least two pieces of information :

  • a nodes data.frame, with id column
  • an edges data.frame, with from and to columns, which make the link with id
require(visNetwork, quietly = TRUE)
# minimal example
nodes <- data.frame(id = 1:3)
edges <- data.frame(from = c(1,2), to = c(1,3))
visNetwork(nodes, edges, width = "100%")

Need help ?

Besides the help R functions, a vignette is available, and you can access and read the full javascript API from R using visDocumentation():

# javascrtip api
vignette("Introduction-to-visNetwork") # with CRAN version
# shiny example
shiny::runApp(system.file("shiny", package = "visNetwork"))

© 2020-2021 DataStorm

Fork me on GitHub