align
ObjectAn align
object interacts with the layout
object to reorder or split
observations and, in some cases, add plot components to the layout
.
align(
align_class,
params,
data,
size = NULL,
controls = NULL,
limits = TRUE,
facet = TRUE,
no_axes = NULL,
active = NULL,
free_guides = deprecated(),
free_spaces = deprecated(),
plot_data = deprecated(),
theme = deprecated(),
free_labs = deprecated(),
check.param = TRUE,
call = caller_call()
)
A new align
object.
A Align
object.
A list of parameters for align_class
.
Options for data
:
A matrix, data frame, or atomic vector.
waiver()
: Uses the layout matrix
.
NULL
: No data is set.
A function
(including purrr-like lambda syntax) applied to the layout
matrix
.
The relative size of the plot, can be specified as a
unit
.
Options for controls
:
NULL
: Used when align_*()
functions do not add a plot.
waiver()
: Try to infer controls
based on data
.
Logical; if TRUE
, sets layout limits for the plot.
Logical; if TRUE
, applies facets to the layout. If FALSE
,
limits
will also be set to FALSE
.
Logical; if
TRUE
,
removes axes elements for the alignment axis using theme_no_axes()
. By
default, will controled by the option-
"ggalign.align_no_axes"
.
A active()
object that defines the context settings when
added to a layout.
Logical; if TRUE
, checks parameters and provides
warnings as necessary.
The call
used to construct the Align
object, for reporting
messages.
It is important to note that we consider rows as observations, meaning
vec_size(data)
/NROW(data)
must match the number of observations along the
axis used for alignment (x-axis for a vertical stack layout, y-axis for a
horizontal stack layout).
quad_layout()
/ggheatmap()
: For column annotation, the layout
matrix
will be transposed before use (if data
is a function, it is
applied to the transposed matrix), as column annotation uses columns as
observations but alignment requires rows.
stack_layout()
: The layout matrix is used as is, aligning all plots
along a single axis.
Each of the Align*
objects is just a ggproto()
object, descended from the top-level Align
, and each implements various
methods and fields.
To create a new type of Align*
object, you typically will want to
override one or more of the following:
setup_params
: Prepare parameter or check parameters used by this plot.
setup_data
: Prepare data used by this plot.
compute
: A method used to compute statistics.
layout
: A method used to group observations into panel or reorder
observations.
draw
: A method used to draw the plot. Must return a ggplot
object.