christophergandrud / Networkd3
D3 JavaScript Network Graphs from R
Stars: ✭ 562
Programming Languages
r
7636 projects
Projects that are alternatives of or similar to Networkd3
Particles
A particle simulation engine based on a port of d3-force
Stars: ✭ 104 (-81.49%)
Mutual labels: rstats, d3js
Tabulizer
Bindings for Tabula PDF Table Extractor Library
Stars: ✭ 413 (-26.51%)
Mutual labels: rstats
Upsetr
An R implementation of the UpSet set visualization technique published by Lex, Gehlenborg, et al..
Stars: ✭ 531 (-5.52%)
Mutual labels: rstats
Awesome R
A curated list of awesome R packages, frameworks and software.
Stars: ✭ 4,858 (+764.41%)
Mutual labels: rstats
Tidytuesday
📊 My contributions to the #TidyTuesday challenge
Stars: ✭ 410 (-27.05%)
Mutual labels: rstats
Moderndive book
Statistical Inference via Data Science: A ModernDive into R and the Tidyverse
Stars: ✭ 527 (-6.23%)
Mutual labels: rstats
Clusterprofiler
📊 statistical analysis and visualization of functional profiles for genes and gene clusters
Stars: ✭ 460 (-18.15%)
Mutual labels: rstats
Antd Umi Sys
企业BI系统,数据可视化平台,主要技术:react、antd、umi、dva、es6、less等,与君共勉,互相学习,如果喜欢请start ⭐。
Stars: ✭ 503 (-10.5%)
Mutual labels: d3js
Paletteer
🎨🎨🎨 Collection of most color palettes in a single R package
Stars: ✭ 535 (-4.8%)
Mutual labels: rstats
Geobr
Easy access to official spatial data sets of Brazil in R and Python
Stars: ✭ 411 (-26.87%)
Mutual labels: rstats
Gtsummary
Presentation-Ready Data Summary and Analytic Result Tables
Stars: ✭ 450 (-19.93%)
Mutual labels: rstats
Timevis
📅 Create interactive timeline visualizations in R
Stars: ✭ 470 (-16.37%)
Mutual labels: rstats
Ggalt
🌎 Extra Coordinate Systems, Geoms, Statistical Transformations & Scales for 'ggplot2'
Stars: ✭ 561 (-0.18%)
Mutual labels: rstats
D3 JavaScript Network Graphs from R
This README includes information on set up and a number of basic examples. For more information see the package's main page.
Usage
Here's an example of simpleNetwork
:
library(networkD3)
# Create fake data
src <- c("A", "A", "A", "A", "B", "B", "C", "C", "D")
target <- c("B", "C", "D", "J", "E", "F", "G", "H", "I")
networkData <- data.frame(src, target)
# Plot
simpleNetwork(networkData)
Here's forceNetwork
:
# Load data
data(MisLinks)
data(MisNodes)
# Plot
forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
Group = "group", opacity = 0.7,
colourScale = JS("d3.scaleOrdinal(d3.schemeCategory20);"))
Here's sankeyNetwork
using a downloaded JSON data file:
# 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)
Interacting with igraph
You can use igraph to create network graph data
that can be plotted with networkD3. The igraph_to_networkD3
function converts igraph graphs to lists that work well with
networkD3. For example:
# Load igraph
library(igraph)
# Use igraph to make the graph and find membership
karate <- make_graph("Zachary")
wc <- cluster_walktrap(karate)
members <- membership(wc)
# Convert to object suitable for networkD3
karate_d3 <- igraph_to_networkD3(karate, group = members)
# Create force directed network plot
forceNetwork(Links = karate_d3$links, Nodes = karate_d3$nodes,
Source = 'source', Target = 'target', NodeID = 'name',
Group = 'group')
Saving to an external file
Use saveNetwork
to save a network to stand alone HTML file:
library(magrittr)
simpleNetwork(networkData) %>% saveNetwork(file = 'Net1.html')
Note
networkD3 began as a port of d3Network package to the htmlwidgets framework. d3Network is no longer supported.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].