plotHeatmap {scater} | R Documentation |
Create a heatmap of expression values for each cell and specified features in a SingleCellExperiment object.
plotHeatmap( object, features, columns = NULL, exprs_values = "logcounts", center = FALSE, scale = FALSE, zlim = NULL, color = NULL, colour_columns_by = NULL, column_annotation_colors = list(), order_columns_by = NULL, by_exprs_values = exprs_values, show_colnames = FALSE, cluster_cols = is.null(order_columns_by), swap_rownames = NULL, symmetric = NULL, ... )
object |
A SingleCellExperiment object. |
features |
A character vector of row names, a logical vector, or integer vector of indices specifying rows of |
columns |
A vector specifying the subset of columns in |
exprs_values |
A string or integer scalar indicating which assay of |
center |
A logical scalar indicating whether each feature should have its mean expression centered at zero prior to plotting. |
scale |
A logical scalar specifying whether each feature should have its expression values scaled to have unit variance prior to plotting. |
zlim |
A numeric vector of length 2, specifying the upper and lower bounds for color mapping of expression values.
Values outside this range are set to the most extreme color.
If |
color |
A vector of colours specifying the palette to use for increasing expression.
This defaults to viridis if |
colour_columns_by |
A list of values specifying how the columns should be annotated with colours.
Each entry of the list can be any acceptable input to the |
column_annotation_colors |
A named list of color scales to be used for
the column annotations specified in |
order_columns_by |
A list of values specifying how the columns should be ordered.
Each entry of the list can be any acceptable input to the |
by_exprs_values |
A string or integer scalar specifying which assay to obtain expression values from,
for colouring of column-level data - see the |
show_colnames, cluster_cols, ... |
Additional arguments to pass to |
swap_rownames |
Column name of |
symmetric |
Deprecated and ignored. |
Setting center=TRUE
is useful for examining log-fold changes of each cell's expression profile from the average across all cells.
This avoids issues with the entire row appearing a certain colour because the gene is highly/lowly expressed across all cells.
Setting zlim
preserves the dynamic range of colours in the presence of outliers.
Otherwise, the plot may be dominated by a few genes, which will “flatten” the observed colours for the rest of the heatmap.
Setting order_columns_by
is useful for automatically ordering the heatmap by one or more factors of interest, e.g., cluster identity.
This avoids the need to set colour_columns_by
, cluster_cols
and columns
to achieve the same effect.
A heatmap is produced on the current graphics device.
The output of pheatmap
is invisibly returned.
Aaron Lun
example_sce <- mockSCE() example_sce <- logNormCounts(example_sce) plotHeatmap(example_sce, features=rownames(example_sce)[1:10]) plotHeatmap(example_sce, features=rownames(example_sce)[1:10], center=TRUE) plotHeatmap(example_sce, features=rownames(example_sce)[1:10], colour_columns_by=c("Mutation_Status", "Cell_Cycle"))