scPyviewer.plot_heatmap#

scPyviewer.plot_heatmap(ds, genes, group=None, figsize=None, dpi=150, cmap='viridis', vmin=None, vmax=None, standard_scale=None, swap_axes=False, show_group_bar=True, max_cells=2000, title=None, title_fontsize=11, xlabel=None, ylabel=None, xlabel_fontsize=9, ylabel_fontsize=9, tick_fontsize=7, group_label_fontsize=7, colorbar_label=None, colorbar_fontsize=8, font_family=None)[source]#

Expression heatmap: genes × cells, grouped by a metadata column.

Better than sc.pl.heatmap: direct figsize/dpi control, all font sizes exposed as parameters, per-figure font_family override, and explicit vmin/vmax for color scaling.

Parameters:
  • genes (list[str]) – Genes to show (rows when swap_axes=False).

  • group (str, optional) – obs column used to sort and annotate cells.

  • figsize (tuple, optional) – Figure (width, height) in inches. Auto-computed if None.

  • dpi (int) – Figure resolution.

  • cmap (str) – Matplotlib colormap.

  • vmax (float | None) – Color-scale limits. Auto from data if None.

  • standard_scale ({None, "var", "obs"}) – Normalize each gene ("var") or each cell ("obs") to [0, 1] before plotting.

  • swap_axes (bool) – If True, genes on X and cells on Y.

  • show_group_bar (bool) – Render a color-coded group annotation bar.

  • max_cells (int) – Cap the number of cells (columns) drawn; above this a stratified subsample is shown. Keeps the figure renderable and fast on large datasets (a heatmap can’t display more cells than pixels anyway).

  • title (str, optional) – Figure title.

  • title_fontsize (float) – Title font size.

  • ylabel (str | None) – Axis label overrides.

  • ylabel_fontsize (float) – Axis label font sizes.

  • tick_fontsize (float) – Tick-label font size.

  • group_label_fontsize (float) – Font size of group labels on the annotation bar.

  • colorbar_label (str, optional) – Override colorbar label.

  • colorbar_fontsize (float) – Colorbar label and tick font size.

  • font_family (str, optional) – Font family for this figure only.

  • ds (Dataset)

  • vmin (float | None)

  • vmax

  • xlabel (str | None)

  • ylabel

  • xlabel_fontsize (float)

  • ylabel_fontsize