Plotting results from analyses done on data derived from brain segmentations is a common need, but may be quite laborious. Results from such analyses are usually easier to interpret if the plot can mimic the shape and position in the brain it represents.
ggseg
plots and returns a ggplot object of plotted
aparc regions. Is superseded by the new geom_brain
.
ggseg(
.data = NULL,
atlas = "dk",
position = "dispersed",
view = NULL,
hemisphere = NULL,
adapt_scales = TRUE,
...
)
A .data.frame to use for plot aesthetics. Should include a column called "region" corresponding to aparc regions.
Either a string with the name of atlas to use, or a .data.frame containing atlas information (i.e. pre-loaded atlas).
String choosing how to view the .data. Either "dispersed"[default] or "stacked".
String to choose view of the .data. Any of c("lateral","medial")[default].
String to choose hemisphere to plot. Any of c("left","right")[default].
if TRUE
, then the axes will
be hemisphere without ticks. If FALSE
, then will be latitude
longitude values. Also affected by position
argument
other options sent to geom_polygon for plotting, including mapping aes (cannot include x, y, and group aesthetics).
a ggplot object
This package contains data from various brain parcellations, with convenient functions to inspect the results directly on a brain-plot wither with ggplot (2D polygons).
The Desikan-Killiany Cortical Atlas [default], FreeSurfer cortical segmentations.
FreeSurfer automatic subcortical segmentation of a brain volume
Useful links:
[ggplot2][ggplot], [aes][aes], [geom_polygon][geom_polygon], [coord_fixed][coord_fixed]
library(ggplot2)
ggseg()
ggseg(mapping=aes(fill=region))
if (FALSE) {
ggseg(colour="black", size=.7, mapping=aes(fill=region)) + theme_void()
ggseg(position = "stacked")
ggseg(adapt_scales = FALSE)
}