sigma.js for R. A powerful, full-featured R package for interactive graph visualisation.




Start with the 1) get started guide to get up to speed, then move on to 2) layouts then to 3) buttons and finally 4) dynamic graphs and you should be at ease with the core functionalities.

Features

Customisation

Easily and neatly layout and cluster nodes on your sigmajs graphs.


Layout Cluster

Dynamism

Learn how to make a temporal graph in static R markdown documents.

Dynamic Buttons

Animations

Animate the color, size, and x/y coordinates of the nodes on the canvas.

Animate

sigmajs plays hand-in-hand with Shiny, it lets you:

  • Catch how users interact with your graphs.
  • Easily apply filters.
  • Trigger events.

Have sigmajs play hand-in-hand with other htmlwidgets, such as leaflet, or DT to highlight nodes and neighbours on click.

Build sigmajs graphs from igraph objects or GEXF files in a single function call.

Install

Install the stable version from CRAN.

or the development version Github or Bitbucket.

# install.packages("remotes")
remotes::install_github("JohnCoene/sigmajs") # github
remotes::install_bitbucket("JohnCoene/sigmajs") # bitbucket

Example

Note that the graphs do not work in the RStudio viewer, and thus open in your default browser.

library(sigmajs)

# generate data
nodes <- sg_make_nodes(25) # 20 nodes
edges <- sg_make_edges(nodes, 50) # 50 edges

sigmajs() %>% # initialise
  sg_nodes(nodes, id, label, size) %>% # add nodes
  sg_edges(edges, id, source, target) %>% # add edges
  sg_layout() %>%  # layout
  sg_cluster() %>% # cluster
  sg_drag_nodes() %>% # allows user to drag nodes
  sg_neighbours() # show node neighbours on node click


sigmajs is part of the twinetverse, a set of packages for Twitter network analysis and visualisation: it'll 1) get you started with network data and 2) walk you through from basic use cases to advanced functions.

Demos

Most functions have corresponding demos, execute the command in the run column to see sigmajs in action. You can also see some of these examples here.

sigmajs demos
name run
add-node demo('add-node', package='sigmajs')
add-edge demo('add-edge', package='sigmajs')
add-node-edge demo('add-node-edge', package='sigmajs')
drop-node demo('drop-node', package='sigmajs')
drop-nodes demo('drop-nodes', package='sigmajs')
drop-edges demo('drop-edges', package='sigmajs')
drop-nodes-edges demo('drop-nodes-edges', package='sigmajs')
clear-graph demo('clear-graph', package='sigmajs')
add-nodes demo('add-nodes', package='sigmajs')
add-edges demo('add-edges', package='sigmajs')
add-nodes-delay demo('add-nodes-delay', package='sigmajs')
add-edges-delay demo('add-edges-delay', package='sigmajs')
add-delay demo('add-delay', package='sigmajs')
custom-shapes demo('custom-shapes', package='sigmajs')
drag-nodes demo('drag-nodes', package='sigmajs')
custom-events demo('custom-events', package='sigmajs')
drop-nodes-delay demo('drop-nodes-delay', package='sigmajs')
drop-edges-delay demo('drop-edges-delay', package='sigmajs')
drop-edges-nodes-delay demo('drop-edges-nodes-delay', package='sigmajs')
export-graph demo('export-graph', package='sigmajs')
filter-nodes demo('filter-nodes', package='sigmajs')