heatmap_layout
is a specialized version of quad_alignb()
, which
simplifies the creation of heatmap plots by integrating essential elements
for a standard heatmap layout, ensuring that the appropriate data mapping and
visualization layers are automatically applied. ggheatmap
is an alias for
heatmap_layout
.
Arguments
- data
Default dataset to use for the layout. If not specified, it must be supplied in each plot added to the layout. By default, it will try to inherit from parent layout. If not already a matrix, will be converted to one by
fortify_matrix()
.- mapping
Default list of aesthetic mappings to use for plot. If not specified, must be supplied in each layer added to the plot.
- ...
Additional arguments passed to
fortify_matrix()
.- width, height
The relative width/height of the main plot, can be a
unit
object.- filling
A single string of
"raster"
or"tile"
to indicate the filling style. By default,waiver()
is used, which means that if the input matrix has more than 20,000 cells (nrow * ncol > 20000
),geom_raster()
will be used for performance efficiency; for smaller matrices,geom_tile()
will be used. To customize the filling style, set this toNULL
.For backward compatibility, a single boolean value is acceptable:
TRUE
meanswaiver()
, andFALSE
meansNULL
.By default, the classic heatmap color scheme
scale_fill_gradient2(low = "blue", high = "red")
is utilized for continuous values.You can use the options
"ggalign.heatmap_continuous_fill"
or"ggalign.heatmap_discrete_fill"
to modify the default heatmap body filling color scale. Seescale_fill_continuous()
orscale_fill_discrete()
for details on option settings.- theme
A
theme()
used to render theguides
,title
,subtitle
,caption
,margins
,patch.title
,panel.border
, andbackground
. IfNULL
(default), will inherit from the parentlayout
.- active
A
active()
object that defines the context settings when added to a layout.- set_context
- order
- name
- guides
Please use
plot_align()
function instead.
ggplot2 specification
The data input in ggheatmap
will be converted into the long formated data
frame when drawing. The default mapping will use aes(.data$.x, .data$.y)
,
you can use mapping
argument to control it. The data in the underlying
ggplot
object contains following columns:
.xpanel
and.ypanel
: the column and row panel.x
and.y
: thex
andy
coordinates.row_names
and.column_names
: A factor of the row and column names of the original matrix (only applicable when names exist)..row_index
and.column_index
: the row and column index of the original matrix.value
: the actual matrix value.