The purpose of this package is to allow for flexible, programmatic and interactive plotting of brain connectivity data within Rstudio - negating the need to swap to other visualization tools and allowing for reproducible integration of visualization with analysis scripts that are written in R.
The primary plotting functions: brainconn()
and brainconn3D()
. The primary user input into these function is a connectivity matrix. Several brain atlases come pre-installed and users can also provide a custom atlas (see vignette).
The brainconn()
function allows users to input a binary/weighted and directed/non-directed (i.e. symmetric) connectivity matrix which can be plotted according to MNI coordinates.
The brainconn3D()
allows users to input a binary and non-directed connectivity matrix which is plotted in a 3D and interactive way using plottly.
The atlases currently included with in the packaage can be listed using the list_atlases()
function: aal116
, aal90
, craddock200
, dk68
, dk82_aspree
, dkt62
, gordon_333
, schaefer1000_n7
, schaefer300_17_cog_lang
, schaefer300_n7
, shen_268
, shen_368
. Custom atlases can be easily added as long as you have centroid coordinates in MNI space, see vignette. The check_atlas()
function checks that custom atlases meet the requirements of the plotting functions.
The package can be installed using devtools.
install.packages("remotes")
::install_github("sidchop/brainconn", build_vignettes = TRUE) remotes
The functions are now installed, and you may load them when you want to use them.
The package also has a vignette, to help you get started. You can access it here, or via R:
library(brainconn)
vignette("brainconn")
The primary user input is a connectivity matrix (conmat
).
brainconn(atlas ="schaefer300_n7", conmat=example_unweighted_undirected)
Modifiable features for brainconn
include: view
, node.size
, node.color
, edge.width
, edge.color
, edge.alpha
, background.alpha
, labels
and others (see vignette)
example_unweighted_undirected
x <- brainconn3D(atlas ="Stages_melbBrain", conmat=x, show.legend = F)
p <- p
Included below is a screenshot of the interactive output:
Modifiable features for brainconn3D
include: node.size
, node.color
, edge.width
, edge.color
, adge.alpha
, background.alpha
, labels
and others (see vignette)
Don’t hesitate to ask for support or new features using github issues.