An Align
object interacts with the Layout
object to reorder or
split observations and, in some cases, add plot components to the Layout
.
Usage
align(
align,
data = NULL,
...,
plot = NULL,
size = NULL,
schemes = NULL,
no_axes = NULL,
active = NULL,
call = caller_call()
)
Arguments
- align
An
Align
object.- data
The following options can be used:
NULL
: No data is set.waiver()
: Inherits the data from the layout matrix.A
function
(including purrr-like lambda syntax): Applied to the layout matrix to transform the data before use. To transform the final plot data, please usescheme_data()
.A
matrix
,data.frame
, or atomic vector.
- ...
Additional fields passed to the
align
object.- plot
A ggplot object.
- size
The relative size of the plot, can be specified as a
unit()
. Note that forcircle_layout()
, all size values will be interpreted as relative sizes, as this layout type adjusts based on the available space in the circular arrangement.- schemes
Options for
schemes
:NULL
: Used whenalign
do not add a plot.waiver()
: Try to inferschemes
based ondata
.
- no_axes
Logical; if
TRUE
, removes axes elements for the alignment axis usingtheme_no_axes()
. By default, will use the option-"ggalign.align_no_axes"
.- active
A
active()
object that defines the context settings when added to a layout.- call
The
call
used to construct theAlign
object, for reporting messages.
Details
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.align
: A method used to group observations into panel or reorder observations.draw
: A method used to draw the plot. Must return aggplot
object.
Discrete Axis Alignment
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).
Examples
align_dendro()
#> <Class: AlignDendro AlignHclust Align AlignProto>
#> plot: yes
#> reorder: yes
#> split: no