Learn R Programming

ggbrain

R package for creating plots of brains using ggplot.

Copy Link

Version

Install

install.packages('ggbrain')

Monthly Downloads

438

Version

0.9.0

License

GPL (>= 3)

Maintainer

Michael Hallquist

Last Published

March 20th, 2025

Functions in ggbrain (0.9.0)

geom_region_label

Variant of geom_label used for plotting region labels on slices
ggb

Generic R6 base class that is used to support + semantics
geom_region_text

Variant of geom_text used for plotting region labels on slices
geom_outline

Adds an outline layer to the ggbrain plot, displaying outlines from the non-missing pixels in the specified layer definition
ggbrain

create ggb container object for a given plot
geom_brain

Adds a raster layer to the ggbrain plot, displaying pixels from the specified layer definition
ggbrain_label

R6 class for adding labels to a ggbrain_panel
geom_region_text_repel

Variant of geom_text_repel used for plotting region labels on slices with separation from other labels
ggbrain_images

R6 class for compiling images to render in ggplot
geom_region_label_repel

Variant of geom_label_repel used for plotting region labels on slices with separation from other labels
images

Add images to a ggbrain object
ggplot_add.ggbrain_panel

S3 method to support adding ggbrain_layer objects to an existing ggplot object
ggbrain_layer_brain

R6 class for a single layer of a ggbrain panel using fill geom
ggplot_add.ggbrain_layer

S3 method to support adding ggbrain_layer objects to an existing ggplot object
ggbrain_panel

R6 class for a single panel of a ggbrain image
ggbrain_layer_outline

R6 class for a single layer of a ggbrain panel using outline geom
ggbrain_slices

R6 class for managing slice data for ggbrain plots
ggplot_add.ggbrain_label

S3 method to support adding ggbrain_label objects to an existing ggplot object
ggbrain_plot

An R6 class for constructing a ggbrain plot from a ggbrain_slices object
ggbrain_layer

R6 class for a single layer of a ggbrain panel
integer_breaks

breaks function to encourage integer-valued breaks, based on input from pretty
plot.ggb

S3 method to allow for plot(x) syntax with ggbrain (ggb) objects
nearest_pts

Finds the nearest non-missing neighbors of a target point in a 2D matrix
plot.ggbrain_panel

S3 method to allow for plot() syntax with ggbrain_panel objects
integer_mode

Finds the mode of an integer vector
named_list

little helper function to create named list from objects
nn_impute

Imputes missing values in a 2D matrix based on the nearest non-missing neighbors in a given radius
montage

Convenience function to add many slices in a montage along one of the 3D planes
plot.ggbrain_patchwork

S3 method to allow for plot() syntax with rendered ggbrain patchwork objects
scale_fill_bisided

scale for plotting separate color gradients for positive and negative values
slices

Adds slices to the ggbrain plot, including additional panel aesthetics
mat2df

Fast conversion of 2D mat to 3-column data.frame with dim1, dim2, value
render

Function to convert ggb object to ggplot/patchwork object
render.ggb

S3 method to allow for render(x) syntax with ggbrain (ggb) objects
+.ggbrain_images

summary S3 method for ggbrain_images objects addition operator for combining ggbrain_images objects
sort_mat

Sort Matrix by Column
range_breaks

breaks function for including min + max with labels, and a few unlabeled ticks in between
+.ggb

addition operator for ggb object to support ggplot-like syntax
plot.ggbrain_plot

S3 method to allow for plot() syntax with ggbrain_panel objects
fill_from_edge

This function finds holes by flood filling TRUE into a 2D binary image, starting from the edge
define

Adds contrast definitions to the ggbrain plot
find_threads

This function finds 'threads' hanging off of the edges of blobs in an image, allowing the user to trim them
count_neighbors

This function counts the number of neighboring/touching pixels in a 2D binary image
annotate_coordinates

Adds the coordinate labels to each panel based on the location of the slice along the slicing axis (e.g., z = 15)
df2mat

Convert a 3-column data.frame (dim1, dim2, value) to a 2-D matrix
contrast_parser

helper function to calculate contrasts of one or more images using a combination of image arithmetic and logical subsetting
center_matrix

helper function to center a numeric matrix within a (larger) target matrix size
flood_fill

This function flood fills a binary image with TRUE for any value of FALSE
annotate_slice

Adds custom annotations to a single panel on the ggbrain plot