plot.pheatmap: Plot Method for pheatmap Objects

View source: R/plot_pheatmap.R

plot.pheatmapR Documentation

Plot Method for pheatmap Objects

Description

This S3 method allows pheatmap objects (returned by Celltype_Calculate()) to be plotted using the generic plot() function. Without this method, attempting to use plot() on a pheatmap object results in an error.

Usage

## S3 method for class 'pheatmap'
plot(x, ...)

Arguments

x

A pheatmap object, typically from cluster_results$Heatmap_plot

...

Additional arguments (currently ignored)

Details

Pheatmap objects contain a gtable component that needs to be drawn using grid graphics. This method handles that automatically when plot() is called.

Alternative ways to display pheatmaps:

  • print(pheatmap_object) - Works natively

  • plot(pheatmap_object) - Works after loading SlimR

  • grid::grid.draw(pheatmap_object$gtable) - Direct access

Value

Invisibly returns the input pheatmap object after displaying it

Examples

## Not run: 
# After running Celltype_Calculate()
cluster_results <- Celltype_Calculate(
    seurat_obj = sce,
    gene_list = Markers_list,
    species = "Human"
)

# Now both of these work:
print(cluster_results$Heatmap_plot)
plot(cluster_results$Heatmap_plot)

## End(Not run)


SlimR documentation built on Feb. 5, 2026, 5:08 p.m.