brainconn: Plots brains

View source: R/brainconn.R

brainconnR Documentation

Plots brains

Description

brainconn plots and returns a ggraph object of plotted brain connectivity matrix..

Usage

brainconn(
  atlas,
  background = "ICBM152",
  view = "top",
  conmat = NULL,
  node.size = 4,
  node.color = "network",
  all.nodes = FALSE,
  edge.color = "black",
  edge.alpha = 0.8,
  edge.width = 1,
  edge.color.weighted = FALSE,
  labels = FALSE,
  show.legend = TRUE,
  thr = NULL,
  uthr = NULL,
  scale.edge.width = NULL,
  label.size = 1.5,
  label.edge.weight = FALSE,
  background.alpha = 1
)

Arguments

background

'ICBM152', currently the only background option

view

A sting to choose the view. Can be any of these: c("ortho", "top", "bottom", "left", "right")

conmat

A adjacency matrix. Can be binary, weights, directed or undirected. see example_* data.

node.size

A integer that determines the diameter of the nodes. Can also be a vector of integers with a length equal to the number of ROIs in the atlas

node.color

A string that sets the node color. e.g. "blue". If set to "network", then nodes will be colored according to the network column of the atlas

all.nodes

if TRUE, then all nodes will be shown be hemisphere without ticks. If FALSE, then only nodes with connecting edges will be shown.

edge.color

A string that sets the edge color. e.g. "blue".

edge.alpha

Number between 0-1 to set the transparency of the edges.

edge.width

Number to set the width of the edges.

edge.color.weighted

A boolean that applies when the conmat is weighted. if TRUE, then edges will be colored according to the weight FALSE, the edges will be sized according to weight.

labels

if TRUE, ROI labels for all visible nodes will be shown. If FALSE, then no labes will be shown.

show.legend

if TRUE, legend will be shown. If FALSE, then no legend will be shown.

thr

a optional value to set a threshold on the conmat (e.g. edges with a weighted value lower than the one set here will not be shown)

uthr

a optional value to set a upper threshold on the conmat (e.g. edges with a weighted value higher than the one set here will not be shown)

scale.edge.width

If edge.color.weighted=FALSE, you can use this rescale the edge.width according to weight. e.g. scale.edge.width = c(1,3)

label.size

If labels=TRUE then, label.size can can be set as in integer to control the size of the labels.

label.edge.weight

if TRUE, then the edge weight will be labels along the edge.

background.alpha

Number between 0-1 to set the transparency of the background.

Value

a ggraph object

Author(s)

Sidhant Chopra

Examples

library(brainconn)
x=matrix(0,84,84)
x[1:3,9:11]= 1:3 ;x[9:11,1:3]= 3:1
brainconn(atlas ="Desikan84", conmat=x,
          view="ortho", node.size =2,
          node.color = "pink",
          edge.width = 1, edge.color="blue",
          edge.alpha = 0.65,
          edge.color.weighted = T,
          scale.edge.width=T,
          labels = T,
          all.nodes =F,
          show.legend = T,
          label.size=3, background.alpha=1,
          label.edge.weight=F)

#In order to learn more about the Desikan84 Atlas added to the package run the following command:

library(brainconn)
Desikan84=as.data.frame(Desikan84);Desikan84


Ali-Mahzarnia/brainconn2 documentation built on Feb. 19, 2024, 4:16 a.m.