Align
object will act with the layout
object, reorder or split the
observations, some of them can also add plot components into the layout
object.
Usage
align(
align_class,
params,
data,
size = NULL,
free_labs = waiver(),
free_spaces = waiver(),
plot_data = waiver(),
limits = TRUE,
facet = TRUE,
set_context = TRUE,
order = NULL,
name = NULL,
check.param = TRUE,
call = caller_call()
)
Arguments
- data
A matrix, a data frame, or even a simple vector that will be converted into a one-column matrix. If the
data
argument is set toNULL
, thealign_*
will use thelayout
data. Additionally, thedata
argument can also accept a function (purrr-like lambda is also okay), which will be applied with thelayout
data,It is important to note that all
align_*
functions consider therows
as the observations. It means theNROW(data)
must return the same number with the parallellayout
axis.layout_heatmap
: for column annotation, thelayout
data will be transposed before using (If data is afunction
, it will be applied with the transposed matrix). This is necessary because column annotation uses heatmap columns as observations, but we need rows.layout_stack
: thelayout
data will be used as it is since we place all plots along a single axis.
- size
Plot size, can be an unit object.
- free_labs
A boolean value or a string containing one or more of
"t"
,"l"
,"b"
, and"r"
indicates which axis title should be free from alignment. IfNULL
, all axis title will be aligned. Default: "tlbr".- free_spaces
A boolean value or a string containing one or more of
"t"
,"l"
,"b"
, and"r"
indicates which border spaces should be removed. IfNULL
(default), no space will be removed.- plot_data
A function used to transform the plot data before rendering. By default, it'll inherit from the parent layout. If no parent layout, the default is
NULL
, which means we won't want to modify anything.Used to modify the data after layout has been created, but before the data is handled of to the ggplot2 for rendering. Use this hook if the you needs change the default data for all
geoms
.- limits
A boolean value indicates whether to set the layout limtis for the plot.
- facet
A boolean value indicates whether to set the layout facet for the plot. If this is
FALSE
,limits
will always beFALSE
too.- set_context
A single boolean value indicates whether to set the active context to current plot. If
TRUE
, all subsequent ggplot elements will be added into this plot.- order
An single integer for the layout order.
- name
A string of the plot name. Used to switch the active context in
hmanno()
orstack_active()
.- check.param
A single boolean value indicates whether to check the supplied parameters and warn.
- call
The
call
used to construct theAlign
for reporting messages.
Align
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 annotation.setup_data
: Prepare data used by this annotation.compute
: A method used to compute statistics.layout
: A method used to group heamap rows/columns into panel or reorder heamtap rows/columns.draw
: A method used to draw the plot. Must return aggplot
object.
Examples
align_gg()
#> <ggproto object: Class AlignGG, Align, gg>
#> call: call
#> compute: function
#> data: NULL
#> direction: NULL
#> draw: function
#> extra_params:
#> facet: TRUE
#> facetted_pos_scales: NULL
#> free_labs: waiver
#> free_spaces: waiver
#> ggplot: function
#> input_data: waiver
#> input_params: list
#> isLock: FALSE
#> labels: NULL
#> layout: function
#> limits: TRUE
#> lock: function
#> name: NULL
#> nobs: function
#> order: NA
#> parameters: function
#> params: NULL
#> plot: NULL
#> plot_data: waiver
#> set_context: TRUE
#> setup_data: function
#> setup_params: function
#> size: NAnull
#> statistics: NULL
#> unlock: function
#> super: <ggproto object: Class AlignGG, Align, gg>
align_dendro()
#> <ggproto object: Class AlignDendro, Align, gg>
#> call: call
#> compute: function
#> data: NULL
#> direction: NULL
#> draw: function
#> extra_params:
#> facet: TRUE
#> facetted_pos_scales: NULL
#> free_labs: waiver
#> free_spaces: waiver
#> ggplot: function
#> input_data: waiver
#> input_params: list
#> isLock: FALSE
#> labels: NULL
#> layout: function
#> limits: TRUE
#> lock: function
#> name: NULL
#> nobs: function
#> order: NA
#> parameters: function
#> params: NULL
#> plot: NULL
#> plot_data: waiver
#> set_context: TRUE
#> setup_data: function
#> setup_params: function
#> size: NAnull
#> statistics: NULL
#> unlock: function
#> super: <ggproto object: Class AlignDendro, Align, gg>