Skip to contents

This function creates a heatmap visualization of a numeric matrix using the ComplexHeatmap package. It allows customization of the color scale and overlays numeric values on each cell.

Usage

Vis_Mtx(
  mat = NULL,
  min = -1,
  mid = 0,
  max = 1,
  mincolor = "blue",
  midcolor = "white",
  maxcolor = "red",
  title = "Heatmap",
  legend_name = "value",
  text_reg = "%.2f",
  fontsize = 6
)

Arguments

mat

A numeric matrix to be visualized. Must not be NULL.

min

Minimum value for the color scale. Default is -1.

mid

Midpoint value for the color scale. Default is 0.

max

Maximum value for the color scale. Default is 1.

mincolor

Color representing the minimum value. Default is "blue".

midcolor

Color representing the midpoint value. Default is "white".

maxcolor

Color representing the maximum value. Default is "red".

Value

A Heatmap object representing the input matrix with customized colors and cell labels.

Details

The function uses colorRamp2 to define a color gradient and ComplexHeatmap::Heatmap to generate the heatmap. Each cell displays its numeric value formatted to one decimal place. Row and column clustering are disabled.

Examples

if (FALSE) { # \dontrun{
mat <- matrix(runif(25, -1, 1), nrow = 5)
Vis_Mtx(mat)
} # }