This is similar with ggalign()
function, but it will always use the layout
panel data. ggpanel
is just an alias of align_panel
.
align_panel(
mapping = aes(),
size = NULL,
free_guides = waiver(),
free_spaces = waiver(),
plot_data = waiver(),
theme = waiver(),
free_labs = waiver(),
limits = TRUE,
facet = TRUE,
set_context = TRUE,
order = NULL,
name = NULL
)ggpanel(
mapping = aes(),
size = NULL,
free_guides = waiver(),
free_spaces = waiver(),
plot_data = waiver(),
theme = waiver(),
free_labs = waiver(),
limits = TRUE,
facet = TRUE,
set_context = TRUE,
order = NULL,
name = NULL
)
A AlignPanel
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 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_panel
initializes a ggplot data
and mapping
.
align_panel()
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).
The data in the underlying ggplot
object contains following columns:
.panel
: the panel for current layout axis. It means x-axis
for
vertical stack layout, y-axis
for horizontal stack layout.
.index
: the index of the original layout data.
.x
or .y
: the x
or y
coordinates
ggheatmap(matrix(rnorm(81), nrow = 9)) +
hmanno("top") +
ggalign() +
geom_point(aes(y = value))
Run the code above in your browser using DataLab