Package: ggbrain 0.9.2

ggbrain: Create Images of Volumetric Brain Data in NIfTI Format Using 'ggplot2' Syntax

A 'ggplot2'-consistent approach to generating 2D displays of volumetric brain imaging data. Display data from multiple NIfTI images using standard 'ggplot2' conventions such scales, limits, and themes to control the appearance of displays. The resulting plots are returned as 'patchwork' objects, inheriting from 'ggplot', allowing for any standard modifications of display aesthetics supported by 'ggplot2'.

Authors:Michael Hallquist [aut, cre]

ggbrain_0.9.2.tar.gz
ggbrain_0.9.2.zip(r-4.7)ggbrain_0.9.2.zip(r-4.6)ggbrain_0.9.2.zip(r-4.5)
ggbrain_0.9.2.tgz(r-4.6-x86_64)ggbrain_0.9.2.tgz(r-4.6-arm64)ggbrain_0.9.2.tgz(r-4.5-x86_64)ggbrain_0.9.2.tgz(r-4.5-arm64)
ggbrain_0.9.2.tar.gz(r-4.7-arm64)ggbrain_0.9.2.tar.gz(r-4.7-x86_64)ggbrain_0.9.2.tar.gz(r-4.6-arm64)ggbrain_0.9.2.tar.gz(r-4.6-x86_64)
ggbrain_0.9.2.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
ggbrain/json (API)
NEWS

# Install 'ggbrain' in R:
install.packages('ggbrain', repos = c('https://michaelhallquist.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/michaelhallquist/ggbrain/issues

Pkgdown/docs site:https://michaelhallquist.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

5.61 score 3 stars 18 scripts 534 downloads 30 exports 49 dependencies

Last updated from:64d7a09ac6. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK248
linux-devel-x86_64OK265
source / vignettesOK338
linux-release-arm64OK249
linux-release-x86_64OK249
macos-release-arm64OK185
macos-release-x86_64OK597
macos-oldrel-arm64OK178
macos-oldrel-x86_64OK539
windows-develOK236
windows-releaseOK250
windows-oldrelOK207
wasm-releaseOK168

Exports:annotate_coordinatesannotate_crosshairsannotate_orientationannotate_slicecluster_slicesdefinegeom_braingeom_brain_clusterizedgeom_outlinegeom_region_labelgeom_region_label_repelgeom_region_textgeom_region_text_repelggbrainggbrain_imagesggbrain_labelggbrain_layerggbrain_layer_brainggbrain_layer_outlineggbrain_panelggbrain_plotimagesinteger_breaksmontagenn_imputerange_breaksrenderscale_fill_bisidedslicestarget_resolution

Dependencies:backportsbmpcheckmateclicpp11data.tabledigestdownloaderdplyrfarvergenericsggnewscaleggplot2ggrepelgluegtableigraphimagerisobandjpeglabelinglatticelifecyclemagrittrMatrixpatchworkpillarpkgconfigpngpurrrR6RColorBrewerRcppRcppArmadilloreadbitmaprlangRNiftiS7scalesstringistringrtibbletidyrtidyselecttiffutf8vctrsviridisLitewithr

Aesthetic refinements of ggbrain plots

Rendered fromggbrain_aesthetics.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2025-12-08
Started: 2022-10-12

Introduction to ggbrain

Rendered fromggbrain_introduction.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2025-12-06
Started: 2022-07-28

Working with annotations and labels in ggbrain

Rendered fromggbrain_labels.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2025-03-21
Started: 2023-06-16

Readme and manuals

Help Manual

Help pageTopics
addition operator for ggb object to support ggplot-like syntax+.ggb
summary S3 method for ggbrain_images objects addition operator for combining ggbrain_images objects+.ggbrain_images
Adds the coordinate labels to each panel based on the location of the slice along the slicing axis (e.g., z = 15)annotate_coordinates
Annotate crosshairs at user-specified world (xyz) coordinatesannotate_crosshairs
Annotate orientation labels (L/R/A/P/S/I) on each panel using NIfTI header infoannotate_orientation
Adds custom annotations to a single panel on the ggbrain plotannotate_slice
Find slice locations based on cluster centers of mass in a 3D brain imagecluster_slices
This function counts the number of neighboring/touching pixels in a 2D binary imagecount_neighbors
Adds contrast definitions to the ggbrain plotdefine
This function finds holes by flood filling TRUE into a 2D binary image, starting from the edgefill_from_edge
This function finds 'threads' hanging off of the edges of blobs in an image, allowing the user to trim themfind_threads
This function flood fills a binary image with TRUE for any value of FALSEflood_fill
Adds a raster layer to the ggbrain plot, displaying pixels from the specified layer definitiongeom_brain
Clusterize a contrast/image and display clusters as categorical fillgeom_brain_clusterized
Adds an outline layer to the ggbrain plot, displaying outlines from the non-missing pixels in the specified layer definitiongeom_outline
Variant of geom_label used for plotting region labels on slicesgeom_region_label
Variant of geom_label_repel used for plotting region labels on slices with separation from other labelsgeom_region_label_repel
Variant of geom_text used for plotting region labels on slicesgeom_region_text
Variant of geom_text_repel used for plotting region labels on slices with separation from other labelsgeom_region_text_repel
create ggb container object for a given plotggbrain
R6 class for compiling images to render in ggplotggbrain_images
R6 class for adding labels to a ggbrain_panelggbrain_label
R6 class for a single layer of a ggbrain panelggbrain_layer
R6 class for a single layer of a ggbrain panel using fill geomggbrain_layer_brain
R6 class for a single layer of a ggbrain panel using outline geomggbrain_layer_outline
R6 class for a single panel of a ggbrain imageggbrain_panel
An R6 class for constructing a ggbrain plot from a ggbrain_slices objectggbrain_plot
S3 method to support adding ggbrain_label objects to an existing ggplot objectggplot_add.ggbrain_label
S3 method to support adding ggbrain_layer objects to an existing ggplot objectggplot_add.ggbrain_layer
S3 method to support adding ggbrain_layer objects to an existing ggplot objectggplot_add.ggbrain_panel
Add images to a ggbrain objectimages
breaks function to encourage integer-valued breaks, based on input from prettyinteger_breaks
Convenience function to add many slices in a montage along one of the 3D planesmontage
Imputes missing values in a 2D matrix based on the nearest non-missing neighbors in a given radiusnn_impute
S3 method to allow for plot(x) syntax with ggbrain (ggb) objectsplot.ggb
S3 method to allow for plot() syntax with ggbrain_panel objectsplot.ggbrain_panel
S3 method to allow for plot() syntax with rendered ggbrain patchwork objectsplot.ggbrain_patchwork print.ggbrain_patchwork
S3 method to allow for plot() syntax with ggbrain_panel objectsplot.ggbrain_plot
breaks function for including min + max with labels, and a few unlabeled ticks in betweenrange_breaks
Function to convert 'ggb' object to ggplot/patchwork objectrender
S3 method to allow for render(x) syntax with ggbrain (ggb) objectsrender.ggb
scale for plotting separate color gradients for positive and negative valuesscale_fill_bisided
Adds slices to the ggbrain plot, including additional panel aestheticsslices
Set the target resolution for resampling slices in a ggbrain plottarget_resolution