plot_heatmap: Plots a heatmap

View source: R/heatmap.R

plot_heatmapR Documentation

Plots a heatmap

Description

Transforms a numeric data frame/matrix and plots corresponding heatmap using the pheatmap function and saves to file

Usage

plot_heatmap(
  mat,
  ann_row = NA,
  ann_col = NA,
  ann_colors = NA,
  plot_title = "",
  out_dir = ".",
  labels = "",
  clust_row = F,
  clust_col = F,
  fontsize_col = 7,
  log10 = F,
  z_score = F,
  man_scale = T,
  man_scale_range = c(-2, 2),
  scale_func = F,
  col.or.row = 2,
  pheatmap_scale = "none",
  clustering_distance_rows = "euclidean",
  clustering_distance_cols = "euclidean",
  clustering_method = "complete",
  show_colnames = T,
  show_rownames = F,
  gradient_palette = "RdBu",
  border_color = NA,
  ...
)

Arguments

mat

Numeric matrix or data frame directory.

ann_row

A data frame that defines annotations or features for rows of the data matrix. The row names should the same as the row names of the data matrix.

ann_col

A data frame that defines annotations or features for columns of the data matrix. The row names should the same as the column names of the data matrix.

ann_colors

A list that specifies annotation colors (each element is a named vector, where names are unique groups in annotations), names of list are the annotation names.

out_dir

The output directory where the plot will be saved, default is current working

labels

A character vector of at least length 1 that will be collapsed for file name.

clust_row

Logical indicating whether to cluster rows

clust_col

Logical indicating whether to cluster rows

log10

Logical indicating whether to log10-transform values before plotting

z_score

Logical indicating whether to plot z_scores

man_scale

Logical indicating whether to manually scale each row/column using rescale() from scales package

man_scale_range

Numeric vector of length 2 indicating desired range of values e.g. c(-4,4), applied when man_scale is TRUE.

scale_func

Logical indicating whether to scale matrix using scale()

col.or.row

numeric - 1 for row, 2 for column. Only applicable when z_score, scale_func, man_scale are TRUE.

pheatmap_scale

String describing which direction around the mean to scale by. Accepts the same values ("none", "row", "column") as scale parameter in ?pheatmap

clustering_distance_rows

Distance measure to be used for row clustering. Accepts the same values as method parameter in ?dist.

clustering_distance_cols

Distance measure to be used for column clustering. Accepts the same values as method parameter in ?dist.

clustering_method

The agglomeration/clustering method to be used. Accepts the same values as method parameter in ?hclust.

show_colnames

Logical indicating whether to show column names on heatmap. See ?pheatmap

show_rownames

Logical indicating whether to show row names on heatmap. See ?pheatmap

gradient_palette

RColorBrewer palette. See RColorBrewer::display.brewer.all() for all options.

...

Additional plotting parameters. Parameters passed to pheatmap, see ?pheatmap.

See Also

Other plotting: plot_corrplot(), plot_corrplotgg(), plot_discrete_barplot(), plot_het_barplot(), plot_indiv_boxplot(), plot_indiv_corrscatt(), plot_indiv_paired(), plot_overview_boxplot(), plot_overview_corr_scatt(), plot_profile_barplot(), run_corrplot_analysis()


kazeera/hourglass documentation built on April 5, 2025, 7:18 a.m.