Generates a heatmap with hierarchical clustering applied to rows and columns. It reorders the input matrix based on clustering results and visualizes the data.
cocluster_plot(
data,
labels.row = NULL,
labels.col = NULL,
colors = "Blues",
breaks = NULL,
title = "Clustered Heatmap",
border.color = "black",
cell.ratio = 1,
cluster.rows = TRUE,
cluster.cols = TRUE,
clustering.distance.rows = "euclidean",
clustering.distance.cols = "euclidean",
row.clustering.method = "complete",
col.clustering.method = "complete",
show.row.names = TRUE,
show.col.names = TRUE,
fontsize = 8,
fontsize.row = NULL,
fontsize.col = NULL,
display.numbers = FALSE,
round.digits = 2,
numbers.color = "black",
numbers.fontsize = 0.5,
label.color = "black",
col.name.angle = 45,
legend = TRUE,
legend.labels = NULL,
show.legend.labels = TRUE,
...
)A `ggplot2` object.
A numeric matrix for the heatmap.
An optional character vector of new labels for the rows.
An optional character vector of new labels for the columns.
A character string specifying one of the predefined palettes or a custom vector of colors. Predefined options include:
"YlOrRd", "YlOrBr", "YlGnBu", "YlGn", "Reds", "RdPu", "Purples", "PuBu", "PuBuGn", "OrRd", "Oranges", "Greys", "Greens", "GnBu", "BuPu", "BuGn", "Blues"
Defaults to "Blues".
The number of color breaks to use for the palette. Defaults to `NULL`.
Plot title. Default: "Clustered Heatmap".
Color of cell borders on the heatmap. Use "NA" for no border. Default: "white".
A numeric value defining the cell's height-to-width ratio. A value of 1 creates square cells. A value > 1 creates vertical rectangles, while a value < 1 creates horizontal rectangles. Default is 1.
A logical value indicating whether to cluster rows. Default: `TRUE`.
A logical value indicating whether to cluster columns. Default: `TRUE`.
Distance measure for row clustering. Can be a string ("euclidean", "correlation", etc.) or a pre-calculated distance object. Default: "euclidean".
Distance measure for column clustering. Can be a string ("euclidean", "correlation", etc.) or a pre-calculated distance object. Default: "euclidean".
Agglomeration method for row clustering (see `?hclust`). Default: "complete".
Agglomeration method for column clustering (see `?hclust`). Default: "complete".
Logical, display row names. Default: TRUE.
Logical, display column names. Default: TRUE.
Base font size for the plot. Default: 8.
Font size for row names. If `NULL`, defaults to `fontsize`.
Font size for column names. If `NULL`, defaults to `fontsize`.
Logical determining if the numeric values are also printed to the cells.
Numeric value. For `display.numbers = TRUE`, this sets the decimal places for all values. Default: 2.
Color of the numbers. Default: "black".
Font size of the numbers. Default: `fontsize`.
Color of the row and column labels. Default: "black".
Angle for column names. Default: 45.
A logical value indicating whether to show the color legend. Default: `TRUE`.
A character vector of custom labels for the legend.
Logical, display legend labels. Default: TRUE.
...