| ggb | R Documentation |
Generic R6 base class that is used to support + semantics
Generic R6 base class that is used to support + semantics
this object becomes a simple storage class that contains all relevant objects (e.g., ggbrain_images) required to generate a brain plot
ggb_imagesggbrain_images object for this plot
ggb_image_labelsa named list of data.frames that label corresponding images
ggb_sliceslist slices to extract for this plot
ggb_contrastsa character vector of contrasts to be computed as part of this plot
ggb_layersa list of ggbrain_layer objects containing the bottom-to-top layers to be plotted
ggb_plota ggbrain_plot object containing the specification of the plot
ggb_annotationsa list of annotation objects
ggb_region_labelsa list of ggbrain_label objects to be added as text to label regions
actionwhat 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 )
imagesa ggbrain_images object containing relevant images
slicesa character vector of slices to extract
contrastsa character vector of contrasts to define and compute
layersa list of ggbrain_layer objects
labelsa list of data.frames with labels that align with one or more images
annotationsa list of data.frames with annotations that will be added to specific slices
region_labelsa list of ggbrain_label objects with text-based labels to be drawn on the plot
titleoverall title of the plot
bg_colorthe background color of the overall plot
text_colorthe text color of the overall plot
base_sizethe base size of text on the plot
actionthe 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)
ilista 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)
slicesa character vector of slices to be appended to the existing slices
add_contrasts()add contrast definitions to the plot object
ggb$add_contrasts(contrasts)
contrastsa character vector of contrasts to compute as part of the plot generation
add_annotations()add annotations to panels
ggb$add_annotations(annotations = NULL)
annotationsa 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)
labelsa 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")
guidesPasses 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).
plot()plot this ggb object – just an alias for render
ggb$plot(guides = "collect")
guidesPasses 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)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.