library("edgebundleR")
This package creates a hierarchical edge bundle plots; similar to the D3 example. The main function in the package is edgebundle()
. It takes in a variety of inputs:
You can install this (large) package using
install.packages("edgebundleR")
library(edgebundleR) library(MASS) data(mtcars, package = "datasets") sig = kronecker(diag(3), matrix(2, 5, 5)) + 3 * diag(15) X = MASS::mvrnorm(n = 100, mu = rep(0, 15), Sigma = sig) colnames(X) = paste(rep(c("A.A", "B.B", "C.C"), each = 5), 1:5, sep = "") edgebundle(cor(X), cutoff = 0.2, tension = 0.8, fontsize = 14)
It can also be used for displaying correlation matrices. We simply calculate the correlation and set any correlations between $-0.7$ and $0.7$ to be zero
cor_mt = cor(mtcars) cor_mt[cor_mt < 0.7 & cor_mt > -0.7] = 0
Then plot as usual
edgebundle(cor_mt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.