Built with blockbuilder.org
| license: mit |
| library(randomNames) | |
| library(networkD3) | |
| library(igraph) | |
| set.seed(3) | |
| nl = 100 | |
| df = data.frame(source = randomNames(1000,which.names='both', name.order = 'first.last', name.sep=' '), target = '') | |
| df = df[rep(seq_len(nrow(df)), sample(1:10,nrow(df), replace=T)),] | |
| df = df[sample(nrow(df),nl),] | |
| df$target = sample(df$source,nrow(df), replace = T) |
| #devtools::install_github('thomasp85/ggforce') | |
| #devtools::install_github("dgrtwo/gganimate") | |
| #devtools::install_github('thomasp85/ggraph') | |
| #devtools::install_github("hadley/ggplot2") | |
| library(ggraph) | |
| library(ggforce) | |
| library(gganimate) | |
| library(ggplot2) | |
| library(igraph) |
| #devtools::install_github('thomasp85/ggforce') | |
| #devtools::install_github("dgrtwo/gganimate") | |
| #devtools::install_github('thomasp85/ggraph') | |
| #devtools::install_github("hadley/ggplot2") | |
| library(ggraph) | |
| library(ggforce) | |
| library(gganimate) | |
| library(ggplot2) | |
| library(igraph) |
forked from nbremer's block: Linear Gradient - Traffic accidents per Day & Hour combination
This is a scatterplot that transforms into a slopechart. The code is entirely built by Gerado Furtado. See here for full example.
This example was made to use as a template to make other scatterplot/slopechart transitions.
Built with blockbuilder.org
Organizing a network made of disconnected pieces like this one is improved by fixing those subgraphs into their own space on the canvas. A while back I showed how to do this using custom code in the tick() function of the D3v3 force layout as part of How to Create Effective Network Data Visualization.
Here's a much easier and cleaner way to do it using the new D3v4 force-layout by specifying a d3.forceY and d3.forceX that are associated with the node's module.
forked from emeeks's block: D3v4 Constraint-Based Layout
Built with blockbuilder.org
| height: 500 | |
| border: yes |