taxa_contribution_heatmap: Heatmap of taxa contributions across functions

View source: R/taxa_contribution_viz.R

taxa_contribution_heatmapR Documentation

Heatmap of taxa contributions across functions

Description

Creates a heatmap showing mean taxa contributions across pathways/functions, with optional clustering and pathway annotations.

Usage

taxa_contribution_heatmap(
  contrib_agg,
  annotation_data = NULL,
  n_functions = 20,
  cluster_rows = TRUE,
  cluster_cols = TRUE,
  clustering_method = "complete",
  clustering_distance = "euclidean",
  low_color = "#f7f7f7",
  high_color = "#ca0020",
  font_size = 12,
  dendro_line_size = 0.5,
  custom_title = NULL
)

Arguments

contrib_agg

A data.frame from aggregate_taxa_contributions.

annotation_data

Optional data.frame from pathway_annotation for replacing function IDs with readable descriptions.

n_functions

Integer. Number of functions to include. Default 20.

cluster_rows

Logical. Cluster rows (taxa)? Default TRUE.

cluster_cols

Logical. Cluster columns (functions)? Default TRUE.

clustering_method

Character. Method for hclust. Default "complete".

clustering_distance

Character. Distance metric. Default "euclidean".

low_color

Character. Color for low values. Default "#f7f7f7".

high_color

Character. Color for high values. Default "#ca0020".

font_size

Numeric. Base font size. Default 12.

dendro_line_size

Numeric. Dendrogram line width. Default 0.5.

custom_title

Optional plot title.

Value

A ggplot2 or patchwork object.

Examples


agg <- data.frame(
  sample = rep(c("S1", "S2"), each = 6),
  function_id = rep(rep(c("K00001", "K00002", "K00003"), each = 2), 2),
  taxon_label = rep(c("Genus_A", "Genus_B"), 6),
  contribution = runif(12)
)
p <- taxa_contribution_heatmap(agg)



ggpicrust2 documentation built on April 10, 2026, 5:06 p.m.