
Create a Correlation Heatmap
spatialcorr.RdCorrelates numeric columns of colData(spe) across spots and draws a full
heatmap in the supplied column order, without clustering.
Arguments
- spe
A
SpatialExperiment.- column
Character vector of at least two numeric
colDatacolumn names, in the desired display order.- cor_method
Correlation method: "pearson", "spearman", or "kendall".
- categories
Optional named character vector mapping column names to categories, shown as color strips above and beside the heatmap. Contiguous category blocks are separated by thin lines and framed on the diagonal.
- category_colors
Optional named vector mapping categories to colors. When NULL, colors are assigned automatically in category appearance order.
- labels
Optional named character vector mapping column names to row labels. Defaults to the column names.
- title
Optional heatmap title; NULL omits it.
- label_title
Heading above the row labels, defaulting to "Source | Feature | Mean"; NULL omits it. For example, "Method | Cell type | Mean relative abundance". This is free text and does not affect the values or labels.
- annotation_legend_param
Named list of category legend settings passed to
ComplexHeatmap::HeatmapAnnotation(), such asnroworlabels_gp.- label_title_gp
Graphical parameters for the heading above row labels.
- draw_param
Named list of settings passed to
ComplexHeatmap::draw(), such asheatmap_legend_side,annotation_legend_side, orpadding. Cannot override the heatmap object, ordering, clustering, or splitting.- ...
Additional arguments to
ComplexHeatmap::Heatmap(), such asrow_names_gp,column_title_gp, orheatmap_legend_param. These override styling defaults, but cannot override the matrix, ordering, labels, title, category annotations, or enable clustering or splitting.
Value
Invisibly, a list containing corr (correlation matrix), heatmap
(the drawn ComplexHeatmap object), used_spots, excluded_spots (spot names,
or positional identifiers if unnamed), and excluded_columns (constant
column names). The heatmap can be redrawn with ComplexHeatmap::draw().
Details
Values are used as supplied: no normalization, cell-type aggregation,
or percentage conversion is performed. Spots with any nonfinite selected
value are excluded jointly, then constant columns are excluded, with warnings.
At least two spots and two variable columns must remain. No p-values are
calculated. This interface replaces the former corrplot-based interface;
select explicit columns with column rather than a method prefix.