Skip to contents

Renders a heatmap of a pairwise distance matrix using ggplot2::geom_tile(). Optionally clusters rows and columns via hierarchical clustering (UPGMA).

Usage

plot_tcrdist_heatmap(dist_matrix, labels = NULL, cluster = TRUE, title = NULL)

Arguments

dist_matrix

Numeric matrix. Square pairwise distance matrix.

labels

Character vector. Row/column labels. If NULL, uses rownames(dist_matrix) or integer indices.

cluster

Logical. If TRUE (default), reorder rows and columns by hierarchical clustering.

title

Optional plot title.

Value

A ggplot object.

Examples

if (FALSE) { # \dontrun{
mat <- matrix(c(0,10,20, 10,0,15, 20,15,0), nrow = 3)
plot_tcrdist_heatmap(mat, labels = c("TCR1", "TCR2", "TCR3"))
} # }