An R6 class for constructing a ggbrain plot from a ggbrain_slices object
Source:R/ggbrain_plot.R
ggbrain_plot.Rd
An R6 class for constructing a ggbrain plot from a ggbrain_slices object
An R6 class for constructing a ggbrain plot from a ggbrain_slices object
Details
Note that this class is exported only for power users and rarely needs to be called directly
in typical use of the package. Instead, look at ggbrain()
.
Active bindings
slices
a ggbrain_slices object containing all slice data for this plot
layers
a list of ggbrain_layer objects for this plot. Note that in assignment, the input can be a list of ggbrain_layer objects, or a list of lists where each inner element specifies the settings for that layer. Example:
list(list(name='hello', fill_scale=scale_fill_distiller())
annotations
a list of annotations to be added to this plot
region_labels
a list of region_labels to be added to this plot
panel_settings
a list of panel settings (aesthetics) to be added to this plot
title
overall plot title, added to composite plot by
patchwork::plot_annotation()
bg_color
background color of plot
text_color
the color of text use across panels (can be overridden by panel settings)
base_size
the base size of text used in ggplot theming
Methods
Method new()
instantiate a new instance of a ggbrain_plot object
Usage
ggbrain_plot$new(
title = NULL,
bg_color = NULL,
text_color = NULL,
base_size = NULL,
slice_data = NULL
)
Method generate_plot()
generate the plot
Arguments
layers
a list of layers to be displayed on each panel, the order of which yields the bottom-to-to drawing order within ggplot2. Each element of
layers
should be a list that follows the approximate structure of the ggbrain_layer class, minimally including the layername
, which is used to lookup data of images or contrasts within the slice_data object. If NULL, all layers in the slices object will be plotted. If only a character string is passed, then those layers will be plotted with default scales.slice_indices
An optional subset of slice indices to display from the stored slice data
Details
In addition to name
, the elements of a layer can include
fill_scale
a ggplot2 scale object for coloring the layer. Should be a scale_fill_* object.
limits
the numeric limits to use for the color scale of this layer
breaks
the scale breaks to use for the color scale of this layer
show_legend
if FALSE, the color scale will not appear in the legend
Method plot()
return a plot of all panels as a patchwork object