Generic R6 base class that is used to support + semantics
Generic R6 base class that is used to support + semantics
ggb_images
ggbrain_images object for this plot
ggb_image_labels
a named list of data.frames that label corresponding images
ggb_slices
list slices to extract for this plot
ggb_contrasts
a character vector of contrasts to be computed as part of this plot
ggb_layers
a list of ggbrain_layer objects containing the bottom-to-top layers to be plotted
ggb_plot
a ggbrain_plot object containing the specification of the plot
ggb_annotations
a list of annotation objects
ggb_region_labels
a list of ggbrain_label objects to be added as text to label regions
action
what should this ggb object contribute to another when added with it?
new()
create a new ggb object. Note that inputs are always cloned to avoid unintended modify-in-place behaviors of R6 classes.
ggb$new(
images = NULL,
slices = NULL,
contrasts = NULL,
layers = NULL,
labels = NULL,
annotations = NULL,
region_labels = NULL,
title = NULL,
bg_color = NULL,
text_color = NULL,
base_size = NULL,
action = NULL
)
images
a ggbrain_images object containing relevant images
slices
a character vector of slices to extract
contrasts
a character vector of contrasts to define and compute
layers
a list of ggbrain_layer objects
labels
a list of data.frames with labels that align with one or more images
annotations
a list of data.frames with annotations that will be added to specific slices
region_labels
a list of ggbrain_label objects with text-based labels to be drawn on the plot
title
overall title of the plot
bg_color
the background color of the overall plot
text_color
the text color of the overall plot
base_size
the base size of text on the plot
action
the action to be taken when adding this object to an existing ggb
add_layers()
add layers from another ggb object to this one
ggb$add_layers(ilist)
ilist
a list of ggbrain_layer objects. If a ggb object is passed, we will get this list from obj$ggb_layers
add_slices()
add slices to the existing vector of slices
ggb$add_slices(slices = NULL)
slices
a character vector of slices to be appended to the existing slices
add_contrasts()
add contrast definitions to the plot object
ggb$add_contrasts(contrasts)
contrasts
a character vector of contrasts to compute as part of the plot generation
add_annotations()
add annotations to panels
ggb$add_annotations(annotations = NULL)
annotations
a list or data.frame containing the annotations to add to each panel. Minimally,
the list or data.frame must contain position
and label
columns that define the position
and text to be added. Other arguments that pass through to ggplot2::annotate() can be provided as columns/elements
in annotations
and these will be passed through to annotate
add_image_labels()
add labels to a given image
ggb$add_image_labels(...)
...
a named list of arguments where each is a data.frame with labels denoting corresponding images
add_region_labels()
add a list of ggbrain_label objects to the overall ggb for compiling a plot
ggb$add_region_labels(labels = NULL)
labels
a list of data.frames with region labels that should be plotted on each slice. This is generated internally by ggbrain_images$get_slices() in the $slice_labels field.
render()
this method converts the ggb object into a compiled ggplot2 object that can then be passed to other functions from cowplot, ggplot2, and patchwork. Once the object is rendered, it no longer retains the underlying ggb fields that contain the elemental data.
ggb$render(guides = "collect")
guides
Passes through to patchwork::plot_layout to control how legends are combined across plots. The default is "collect", which collects legends within a given nesting level (removes duplicates).
guides
Passes through to patchwork::plot_layout to control how legends are combined across plots. The default is "collect", which collects legends within a given nesting level (removes duplicates).
requires that required elements are in place already.
clone()
The objects of this class are cloneable with this method.
ggb$clone(deep = FALSE)
deep
Whether to make a deep clone.
this object becomes a simple storage class that contains all relevant objects (e.g., ggbrain_images) required to generate a brain plot