Skip to contents

ggheatmap is an alias of heatmap_layout.

Usage

heatmap_layout(
  data,
  mapping = aes(),
  ...,
  .width = NA,
  .height = NA,
  action = NULL,
  theme = NULL,
  filling = TRUE,
  set_context = TRUE,
  order = NULL,
  name = NULL,
  guides = deprecated()
)

ggheatmap(
  data,
  mapping = aes(),
  ...,
  .width = NA,
  .height = NA,
  action = NULL,
  theme = NULL,
  filling = TRUE,
  set_context = TRUE,
  order = NULL,
  name = NULL,
  guides = deprecated()
)

Arguments

data

A numeric or character vector, a data frame, and any other data which can be converted into a matrix. Simple vector will be converted into a one column matrix.

mapping

Default list of aesthetic mappings to use for plot. In addition, we will always add mapping aes(.data$.x, .data$.y).

...

Additional arguments passed to geom_tile()/geom_raster(). Only used when filling = TRUE.

.width, .height

Heatmap body width/height, can be a unit object.

action

A plot_action() object used to define the default plot action in the layout.

theme

A theme() used to render the guides, title, subtitle, caption, margins, patch.title, panel.border, and background. If NULL (default), will inherit from the parent layout.

filling

A boolean value indicating whether to fill the heatmap. If you wish to customize the filling style, set this to FALSE.

By default, the classic heatmap colour scheme scale_fill_gradient2(low = "blue", high = "red") is utilized for continuous values. You can use the option "ggalign.heatmap_continuous_fill" or "ggalign.heatmap_discrete_fill" to modify the default heatmap body fill color scale. See scale_fill_continuous() or scale_fill_discrete() for option setting details.

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 plot area order.

name

A string of the plot name. Used to switch the active context in hmanno() or stack_active().

guides

A string with one or more of "t", "l", "b", and "r" indicating which side of guide legends should be collected. Defaults to waiver(), which inherits from the parent layout. If there is no parent layout, or if NULL is provided, no guides will be collected.

Value

A HeatmapLayout object.

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: the x and y 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.

Examples

ggheatmap(1:10)
#> → heatmap built with `geom_tile()`

ggheatmap(letters)
#> → heatmap built with `geom_tile()`

ggheatmap(matrix(rnorm(81), nrow = 9L))
#> → heatmap built with `geom_tile()`