ggalign
is just an alias of align_gg
.
align_gg(
mapping = aes(),
size = NULL,
free_guides = waiver(),
free_spaces = waiver(),
plot_data = waiver(),
theme = waiver(),
free_labs = waiver(),
data = NULL,
limits = TRUE,
facet = TRUE,
set_context = TRUE,
order = NULL,
name = NULL
)ggalign(
mapping = aes(),
size = NULL,
free_guides = waiver(),
free_spaces = waiver(),
plot_data = waiver(),
theme = waiver(),
free_labs = waiver(),
data = NULL,
limits = TRUE,
facet = TRUE,
set_context = TRUE,
order = NULL,
name = NULL
)
A AlignGG
object.
Additional default list of aesthetic mappings to use for plot.
Plot size, can be an unit object.
Override the guides
argument specified in the layout for
a plot. Options include:
waiver()
: inherits behavior from the layout.
NULL
: no guide legends will be collected for the plot.
A string containing one or more of "t"
, "l"
, "b"
, and "r"
indicates which side of guide legends should be collected for the plot..
A string with one or more of "t"
, "l"
, "b"
, and "r"
indicating which border spaces should be removed. Defaults to
waiver()
, which inherits from the parent layout. If no
parent, the default is NULL
, meaning no spaces are removed.
A function to transform plot data before rendering. Defaults
to waiver()
, which inherits from the parent layout. If
no parent layout, the default is NULL
, meaning the data won't be modified.
Used to modify the data after layout has been created, which should be a data
frame, 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
.
Default plot theme: One of:
Note:
The axis title and labels parallel to the layout axis will always be
removed by default. For vertical stack layouts, this refers to the x-axis
,
and for horizontal stack layouts, this refers to the y-axis
. If you want to
display the axis title or labels, you should manually add
theme() elements for the parallel axis title or labels.
A string with one or more of "t"
, "l"
, "b"
, and "r"
indicating
which axis titles should be free from alignment. Defaults to
waiver()
, which inherits from the parent layout. If no
parent layout, no axis titles will be aligned. If NULL
, all axis titles
will be aligned.
A matrix, data frame, or a simple vector. If an atomic vector is
provided, it will be converted into a one-column matrix. When data = NULL
,
the internal layout
data will be used by default. Additionally, data
can
be a function (including purrr-like lambdas), which will be applied to the
layout
data.
It is important to note that we consider the rows
as the observations. It
means the NROW(data)
must return the same number with the specific layout
axis (meaning the x-axis for vertical stack layout, or y-axis for horizontal
stack layout).
heatmap_layout()
: for column annotation, the layout
data will be
transposed before using (If data is a function
, it will be applied with
the transposed matrix). This is necessary because column annotation uses
heatmap columns as observations, but we need rows.
stack_layout()
: the layout
data will be used as it is since we place
all plots along a single axis.
A boolean value indicates whether to set the layout limtis for the plot.
A boolean value indicates whether to set the layout facet for
the plot. If this is FALSE
, limits
will always be FALSE
too.
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.
An single integer for the plot area order.
A string of the plot name. Used to switch the active context in
hmanno()
or stack_active()
.
align_gg
initializes a ggplot data
and mapping
.
align_gg()
always applies a default mapping for the axis of the data index
in the layout. This mapping is aes(y = .data$.y)
for horizontal stack
layout (including left and right heatmap annotation) and aes(x = .data$.x)
for vertical stack layout (including top and bottom heatmap annotation).
For ggplot usage, matrix (including a simple vector) data is converted into a
long-format data frame. The data in the underlying ggplot
object will
contain following columns:
.panel
: the panel for current layout axis. It means x-axis
for
vertical stack layout, y-axis
for horizontal stack layout.
.x
or .y
: the x
or y
coordinates
.row_names
and .row_index
: A factor of the row names and an integer of
row index of the original matrix or data frame.
.column_names
and .column_index
: the column names and column index of
the original matrix (only applicable if data
is a matrix
).
value
: the actual matrix value (only applicable if data
is a
matrix
).
In the case where the input data is already a data frame, three additional
columns (.row_names
, .row_index
, and .panel
) are added to the data
frame.
If the data is inherit from heatmap_layout()
, an additional column will be
added.
.extra_panel
: the panel information for column (left or right
annotation) or row (top or bottom annotation).
ggheatmap(matrix(rnorm(81), nrow = 9)) +
hmanno("top") +
ggalign() +
geom_point(aes(y = value))
Run the code above in your browser using DataLab