Skip to content

timelyportfolio/sankeyD3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

D3 JavaScript Sankey Network Graphs from R

Version 0.1

This project is based on the Sankey implementation in networkD3 and d3-sankey.

Changelog:

The inst/examples/shiny web-app exposes several of the features: image

Usage

# Recreate Bostock Sankey diagram: http://bost.ocks.org/mike/sankey/
# Load energy projection data
URL <- paste0("https://cdn.rawgit.com/christophergandrud/networkD3/",
              "master/JSONdata/energy.json")
Energy <- jsonlite::fromJSON(URL)

# Plot
sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source",
             Target = "target", Value = "value", NodeID = "name",
             units = "TWh", fontSize = 12, nodeWidth = 30)

Saving to an external file

Use saveNetwork to save a network to stand alone HTML file:

library(magrittr)

simpleNetwork(networkData) %>% saveNetwork(file = 'Net1.html')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 96.7%
  • R 2.1%
  • JavaScript 1.2%