R6 class for a single panel of a ggbrain image
R6 class for a single panel of a ggbrain image
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 slices().
Methods
Method new()
create a new ggbrain_panel object
Usage
ggbrain_panel$new(
layers = NULL,
title = NULL,
bg_color = NULL,
text_color = NULL,
border_color = NULL,
border_size = NULL,
xlab = NULL,
ylab = NULL,
theme_custom = NULL,
annotations = NULL,
region_labels = NULL
)Arguments
layersa list of ggbrain_layer objects to form the panel
titlea title for the panel added to the ggplot object using ggtitle()
bg_colorthe color used for the background of the plot. Default: 'gray10' (nearly black)
text_colorthe color used for text displayed on the plot. Default: 'white'.
border_colorthe color used for drawing a border around on the plot. Default: 'gray50' (though borders are not drawn by default).
border_sizethe size of the border line drawn around the panel. Default: NULL. If this value is greater than zero, a border of this size and with color
border_colorwill be drawn around the panelxlabThe label to place on x axis. Default is NULL.
ylabThe label to place on y axis. Default is NULL.
theme_customAny custom theme() settings to be added to the plot
annotationsa data.frame containing all annotations to be added to this plot. Each row is cleaned up and passed to ggplot2::annotate()
region_labelsa list of ggbrain_label objects with data for plotting region labels on this panel
Method plot()
plot the panel
Method add_to_gg()
add one or more custom ggplot settings to the panel
Details
Note that passing in an expression such as theme_bw() + ggtitle("hello") will not work because it creates an object that cannot be added sequentially to the ggplot. As noted in ggplot2's documentation (https://ggplot2.tidyverse.org/reference/gg-add.html), to programmatically add elements to a ggplot, pass in a list where each element is added sequentially
Method set_layer_order()
sets the order of layers from bottom to top based on the layer names provided