Scanpy API reference

See Scanpy compatibility for coverage, shared differences and supported options.

Plotting

Scanpy plotting entry points; analysis continues through Scanpy itself.

class genome_spy.integrations.scanpy.pl.DotPlot(adata, var_names, groupby, *, use_raw=None, log=False, num_categories=7, categories_order=None, title=None, figsize=None, gene_symbols=None, var_group_positions=None, var_group_labels=None, var_group_rotation=None, layer=None, expression_cutoff=0.0, mean_only_expressed=False, standard_scale=None, dot_color_df=None, dot_size_df=None, vmin=None, vmax=None, vcenter=None, norm=None, hover=True, zoom=False, highlight=False, group_gap=0, width=None, height=None, **kwds)View on GitHub

Build a grouped dotplot with Scanpy-style method chains.

Read selected expression once at construction. Methods mutate this builder and return self; each to_chart call returns a detached native chart. Use that chart’s composition, display and HTML/JSON saving APIs.

Parameters:
  • adata – AnnData containing expression and grouping annotations.

  • var_names – Feature keys, repeated slots, or labeled feature groups.

  • groupby – Observation key or categorical grouping keys.

  • use_raw – Use raw when available; layer overrides the automatic choice.

  • log – Apply log1p before calculating summaries.

  • num_categories – Number of bins for numeric grouping annotations.

  • categories_order – Complete order of grouping categories.

  • title – Plot title.

  • figsize – Native layout budget in inches at 100 logical pixels/inch.

  • gene_symbols – Variable annotation column for symbol lookup.

  • var_group_positions – Inclusive feature-slot bracket endpoints.

  • var_group_labels – Bracket labels; mappings already supply these.

  • var_group_rotation – Bracket label rotation in degrees.

  • layer – Expression layer instead of the automatic raw/X source.

  • expression_cutoff – Strict lower threshold for expressing cells.

  • mean_only_expressed – Average only expressed values, with empty means zero.

  • standard_scale – Scale means per variable or group, following Scanpy.

  • dot_color_df – Authoritative labeled color values.

  • dot_size_df – Authoritative labeled fractions between zero and one.

  • vmin – Numeric lower color bound.

  • vmax – Numeric upper color bound.

  • vcenter – Reserved; nondefault values error.

  • norm – Reserved; Matplotlib normalization objects error.

  • hover – Show gene, group, displayed value and expressing percentage.

  • zoom – True enables y navigation; “xy” also enables x navigation.

  • highlight – False disables feedback; True shows a ruler; “outline” outlines a hovered dot.

  • group_gap – Space between marker blocks in pixels; 0 keeps slots contiguous.

  • width – Plot-area width in logical pixels.

  • height – Plot-area height in logical pixels.

  • **kwds – Only cmap and scalar linewidth are supported.

Returns:

A mutable dotplot builder; construction does not display a chart.

Raises:
  • ImportError – If Scanpy 1.11.5 is unavailable.

  • TypeError – If inputs or forwarded options have invalid types.

  • ValueError – If groups, labels, fractions or dimensions are invalid.

  • NotImplementedError – If a requested renderer option is unsupported.

Example

>>> plot = gsc.pl.DotPlot(pbmc, markers, "louvain")
>>> chart = plot.add_dendrogram().swap_axes().to_chart()
>>> chart.save("markers.html", inline=True)
style(*, cmap=Undefined, color_on=Undefined, dot_max=Undefined, dot_min=Undefined, smallest_dot=Undefined, largest_dot=Undefined, dot_edge_color=Undefined, dot_edge_lw=Undefined, size_exponent=Undefined, grid=Undefined, x_padding=Undefined, y_padding=Undefined)View on GitHub

Update only supplied styles; omitted settings retain their current values.

Parameters:
  • cmap – Native GenomeSpy color scheme; None selects viridis.

  • color_on – Only dot coloring is currently supported.

  • dot_max – Upper fraction limit; None restores the observed maximum.

  • dot_min – Lower fraction limit; None restores zero.

  • smallest_dot – Minimum dot area in points squared.

  • largest_dot – Maximum dot area in points squared.

  • dot_edge_color – Opaque CSS edge color; None removes the edge.

  • dot_edge_lw – Edge width in points; None removes the edge.

  • size_exponent – Positive exponent of the clipped expression fraction.

  • grid – Show native grid lines at the dot centers.

  • x_padding – Horizontal padding in slot units, at least 0.5.

  • y_padding – Vertical padding in slot units, at least 0.5.

Returns:

This builder; scalar styles are validated by the shared renderer.

Raises:

Example

>>> chart = plot.style(dot_edge_color="black", largest_dot=160).to_chart()
legend(*, show=True, show_size_legend=True, show_colorbar=True, size_title='Cells expressing (%)', colorbar_title='Mean expression', width=1.5)View on GitHub

Configure native size/color guides without changing either data scale.

Parameters:
  • show – False or None hides both guides.

  • show_size_legend – Show the percentage guide when show is True.

  • show_colorbar – Show the color guide when show is True.

  • size_title – Percentage guide title, default “Cells expressing (%)”; None omits the title.

  • colorbar_title – Color guide title, default “Mean expression”; None omits the title.

  • width – Native gradient width and figsize guide allowance in inches.

Returns:

This builder for further chaining.

Raises:
  • TypeError – If visibility flags are not boolean or None.

  • ValueError – If a visible guide’s width is not positive and finite.

Example

>>> chart = plot.legend(show_size_legend=False).to_chart()
to_chart()View on GitHub

Render the current settings as a detached, composable native chart.

Returns:

A fresh GenomeSpy chart; later chains do not change this snapshot.

Raises:

Example

>>> combined = plot.to_chart() | another_chart
show(*, return_axes=None)View on GitHub

Display one native chart using the notebook widget.

Parameters:

return_axes – Only None/False; use to_chart for a composable result.

Returns:

None, preventing a duplicate notebook output.

Raises:

TypeError – If return_axes requests Matplotlib axes.

Example

>>> plot.style(cmap="viridis").show()
add_dendrogram(*, show=True, dendrogram_key=None, size=0.8)View on GitHub

Attach the shared group tree, replacing totals while retaining its order.

Parameters:
  • show – False or None hides the group decoration, preserving ordering.

  • dendrogram_key – Stored Scanpy tree key, or the default grouping key.

  • size – Tree track size in inches at 100 logical pixels/inch.

Returns:

This builder for further chaining.

Raises:
  • TypeError – If flags or the tree key have invalid types.

  • ValueError – If the tree or size is invalid.

Example

>>> chart = plot.add_dendrogram().swap_axes().to_chart()
add_totals(*, show=True, sort=None, size=0.8, color=None)View on GitHub

Show group counts with native bars, replacing the dendrogram track.

Parameters:
  • show – False or None hides the decoration while preserving ordering.

  • sort – Sort groups by cell count, or retain their current order.

  • size – Track size in inches at 100 logical pixels/inch.

  • color – One CSS color or one per displayed group; default salmon.

Returns:

This builder for further chaining.

Raises:

Example

>>> chart = plot.add_totals(sort="descending", color="salmon").to_chart()
swap_axes(*, swap_axes=True)View on GitHub

Place groups on x and features on y, or restore the original orientation.

Parameters:

swap_axes – True transposes the plot; False or None restores it.

Returns:

This builder for further chaining.

Raises:

TypeError – If swap_axes is not boolean or None.

Example

>>> chart = plot.swap_axes().to_chart()
class genome_spy.integrations.scanpy.pl.EmbeddingSummary(adata, var_names, groupby, *, basis='umap', use_raw=None, layer=None, gene_symbols=None, categories_order=None, palette=None, obs_keys=(), title=Undefined, show_count=True, zoom=False)View on GitHub

Build an embedding with brush-linked expression summaries.

Copy selected resident gene and observation values once. Chained methods change only presentation; native browser transforms recompute summaries as the brush moves. This GenomeSpy extension is not a Scanpy class. The embedding starts with equal coordinate units, and selected cells receive no additional point effects.

Parameters:
  • adata – AnnData with stored embedding coordinates and resident expression.

  • var_names – Unique gene names; a string selects one gene.

  • groupby – One categorical or string observation column.

  • basis – Stored embedding name, with the usual direct/X_ lookup.

  • use_raw – Use raw when available unless layer is specified.

  • layer – Expression layer instead of raw/X.

  • gene_symbols – Variable annotation column for gene lookup.

  • categories_order – Complete cell-type order.

  • palette – Existing embedding palette forms, including saved AnnData colors.

  • obs_keys – Extra categorical/numeric observation columns copied once.

  • title – Embedding title; omitted uses groupby, None hides it.

  • show_count – Show the selected-cell count inside the brush; defaults to True.

  • zoom – Enable embedding zoom and pan. Shift-drag selects cells when True; drag outside the selection to pan. False keeps ordinary drag selection.

Returns:

A mutable builder; construction does not display a plot.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If inputs have unsupported types.

  • ValueError – If genes, groups, coordinates or options are invalid.

  • NotImplementedError – If expression is not resident or grouping is numeric.

Example

>>> plot = gsc.pl.EmbeddingSummary(adata, ["CD3D", "LYZ"], "cell_type")
>>> chart = plot.add_heatmap().add_histogram("LYZ").to_chart()
add_heatmap(var_names=None, *, show=True, position='right', width=300, height=160, cmap='seurat', vmin=None, vmax=None, title=Undefined, show_values=False, gene_controls=False)View on GitHub

Enable or replace the selected-cell group-mean heatmap.

Parameters:
  • var_names – Subset of constructor genes, in display order; None uses all.

  • show – False hides the panel.

  • position – Side of the embedding composition.

  • width – Minimum plot-area width; native concat aligns adjacent panels.

  • height – Minimum plot-area height in logical pixels.

  • cmap – Native scheme or zero-centered “seurat” preset.

  • vmin – Fixed lower color limit; None derives it from loaded values.

  • vmax – Fixed upper color limit; None derives it from loaded values.

  • title – Panel title; omitted uses the summary label, None hides it.

  • show_values – Show fitted group means with the shared native text style.

  • gene_controls – Show one native gene selector per row, using constructor genes.

Returns:

This builder for further chaining.

Raises:
  • ValueError – If genes, placement or dimensions are invalid.

  • TypeError – If show, show_values or gene_controls is not boolean.

Example

>>> plot.add_heatmap(["LYZ"], position="bottom", vmin=-2.5, vmax=2.5)
add_tracks(var_names=None, *, show=True, position='bottom', width=600, height=220, zoom=True, group_gap=0, spacing=0, title=Undefined)View on GitHub

Add marker tracks that highlight cells selected in the embedding.

Reuse the loaded expression without scaling or analysis. Cell order stays fixed by group; unselected cells fade and clearing restores the full tracks.

Parameters:
  • var_names – Subset of constructor genes; None uses all.

  • show – False hides the tracks panel.

  • position – Side of the embedding composition.

  • width – Track plotting width in logical pixels.

  • height – Combined height of the gene tracks in logical pixels.

  • zoom – Allow horizontal zoom and pan across all tracks.

  • group_gap – Space between cell groups in pixels; zero removes gaps.

  • spacing – Space between tracks and the category strip in pixels.

  • title – Panel title; omitted uses “Marker expression”, None hides it.

Returns:

This builder for further chaining.

Raises:
  • TypeError – If show or zoom is not boolean.

  • ValueError – If genes, dimensions, placement or spacing are invalid.

Example

>>> plot.add_tracks(["CD3D", "LYZ"], position="bottom")
add_histogram(var_names=None, *, obs=None, show=True, position='bottom', width=300, height=160, bin_width=0.5, title=Undefined, gene_controls=False)View on GitHub

Enable or replace selected-versus-all distributions on one side.

Left/right histograms stack vertically; top/bottom histograms form a row. Calls on different sides keep both groups. Each group follows the same brush.

Parameters:
  • var_names – Constructor genes, one histogram each; None uses the first unless obs is set.

  • obs – Stored numeric obs key from obs_keys, instead of var_names.

  • show – False removes the histogram group on the requested side.

  • position – Side of the embedding composition.

  • width – Minimum plot-area width; native concat aligns adjacent panels.

  • height – Minimum plot-area height of each histogram in logical pixels.

  • bin_width – Positive fixed bin width shared by both cohorts.

  • title – Panel title; omitted derives it from the field, None hides it.

  • gene_controls – Show a native selector per gene histogram, using constructor genes.

Returns:

This builder for further chaining.

Raises:
  • ValueError – If genes, placement, dimensions or bin width are invalid.

  • TypeError – If show or gene_controls is not boolean.

Example

>>> plot.add_histogram("LYZ", bin_width=0.25)
add_composition(key=None, *, show=True, position='right', width=200, height=280, title=Undefined)View on GitHub

Enable or replace paired categorical cohort-percentage bars.

Percentages use all cells in each cohort, including a visible NA category for missing metadata. Category order and colors stay fixed during brushing.

Parameters:
  • key – Categorical obs key from obs_keys; None uses groupby.

  • show – False hides the panel.

  • position – Side of the embedding composition.

  • width – Minimum native plot-area width in logical pixels.

  • height – Minimum native plot-area height in logical pixels.

  • title – Panel title; omitted derives it from key, None hides it.

Returns:

This builder for further chaining.

Raises:

Example

>>> plot.add_composition("sample")
style(*, umap_size=Undefined, size=Undefined, alpha=Undefined, spacing=Undefined)View on GitHub

Update supplied embedding styles without reading AnnData again.

Parameters:
  • umap_size – Square plot-area side length in logical pixels.

  • size – Point area in Scanpy’s square-point units.

  • alpha – Point opacity between zero and one.

  • spacing – Native spacing between plots in logical pixels.

Returns:

This builder for further chaining.

Raises:

ValueError – If a supplied style is invalid.

Example

>>> plot.style(umap_size=360, size=8, alpha=0.85)
legend(*, position='bottom', show=True)View on GitHub

Collect the independent native legends around the whole composition.

Parameters:
  • position – Side of the composition for all legends.

  • show – Whether to show collected legends.

Returns:

This builder for further chaining.

Raises:

Example

>>> plot.legend(position="right")
to_chart()View on GitHub

Return a fresh native chart without reading or retaining AnnData.

Returns:

A composable chart unaffected by later builder changes.

Raises:

Example

>>> chart = plot.to_chart()
>>> chart.save("expression.html", inline=True)
show()View on GitHub

Display the current chart using the native notebook widget.

Returns:

None, preventing duplicate notebook output.

Raises:

ValueError – If current panel settings are invalid.

Example

>>> plot.add_heatmap().show()
class genome_spy.integrations.scanpy.pl.MatrixPlot(adata, var_names, groupby, *, use_raw=None, log=False, num_categories=7, categories_order=None, title=None, figsize=None, gene_symbols=None, var_group_positions=None, var_group_labels=None, var_group_rotation=None, layer=None, standard_scale=None, values_df=None, vmin=None, vmax=None, vcenter=None, norm=None, hover=True, zoom=False, show_values=False, highlight=False, width=None, height=None, **kwds)View on GitHub

Build group-mean tiles with Scanpy-style method chains.

Compute detached summaries once at construction. Methods mutate this builder and return self; each to_chart call creates a fresh native chart for composition, display or HTML/JSON saving. Supplied values skip expression reads, averaging and scaling.

Parameters:
  • adata – AnnData containing expression and grouping annotations.

  • var_names – Feature keys, repeated slots or labeled feature groups.

  • groupby – Observation key or categorical grouping keys.

  • use_raw – Use raw when available; layer overrides the automatic choice.

  • log – Apply log1p before averaging; ignored for supplied values_df.

  • num_categories – Number of bins for numeric grouping annotations.

  • categories_order – Complete group order, also applied to values_df rows.

  • title – Plot title.

  • figsize – Native layout budget in inches at 100 logical pixels/inch.

  • gene_symbols – Variable annotation column for symbol lookup.

  • var_group_positions – Inclusive feature-slot bracket endpoints.

  • var_group_labels – Bracket labels; mappings already supply these.

  • var_group_rotation – Bracket label rotation in degrees.

  • layer – Expression layer instead of the automatic raw/X source.

  • standard_scale – Min–max scale computed means per variable or group once.

  • values_df – Authoritative labeled numeric table, copied without scaling.

  • vmin – Finite numeric lower color bound.

  • vmax – Finite numeric upper color bound.

  • vcenter – Reserved; nondefault values error.

  • norm – Reserved; Matplotlib normalization objects error.

  • hover – Show gene, group and displayed mean or supplied value.

  • zoom – True enables y navigation; “xy” also enables x navigation.

  • show_values – Show values when native fitted text has enough room.

  • highlight – False disables feedback; True shows a ruler; “outline” outlines a hovered tile.

  • width – Plot-area width in logical pixels.

  • height – Plot-area height in logical pixels.

  • **kwds – Only cmap, scalar edgecolor and linewidth are supported.

Returns:

A mutable matrixplot builder; construction does not display a chart.

Raises:
  • ImportError – If Scanpy 1.11.5 is unavailable.

  • TypeError – If inputs or forwarded options have invalid types.

  • ValueError – If table labels, groups or dimensions are invalid.

  • NotImplementedError – If a requested renderer option is unsupported.

Example

>>> plot = gsc.pl.MatrixPlot(pbmc, markers, "louvain", standard_scale="var")
>>> chart = plot.add_dendrogram().style(cmap="Blues").to_chart()
>>> chart.save("markers.html", inline=True)
style(cmap=Undefined, edge_color=Undefined, edge_lw=Undefined)View on GitHub

Update supplied tile styles while keeping omitted settings.

Parameters:
  • cmap – Native GenomeSpy scheme; None selects viridis.

  • edge_color – Opaque CSS color; “none” removes edges. None uses black.

  • edge_lw – Edge width in points; None uses 1.5 points.

Returns:

This builder; the shared renderer validates styles at to_chart.

Raises:

Example

>>> chart = plot.style(cmap="Blues", edge_color="none").to_chart()
legend(*, show=True, title='Expression\nlevel in group', width=1.5)View on GitHub

Set native color guide visibility, title and width.

Parameters:
  • show – False or None hides the color guide.

  • title – Color guide title; None removes its title.

  • width – Gradient length and figsize guide allowance in inches.

Returns:

This builder for further chaining.

Raises:
  • TypeError – If show is not boolean or None.

  • ValueError – If a visible guide’s width is not positive and finite.

Example

>>> chart = plot.legend(title="Scaled mean", width=2).to_chart()
to_chart()View on GitHub

Render the current settings as a detached, composable native chart.

Returns:

A fresh chart; later chains do not change this snapshot.

Raises:

Example

>>> combined = plot.to_chart() | another_chart
show(*, return_axes=None)View on GitHub

Display one native chart using the notebook widget.

Parameters:

return_axes – Only None/False; use to_chart for a composable result.

Returns:

None, preventing a duplicate notebook output.

Raises:

TypeError – If return_axes requests Matplotlib axes.

Example

>>> plot.style(cmap="viridis").show()
add_dendrogram(*, show=True, dendrogram_key=None, size=0.8)View on GitHub

Attach the shared group tree, replacing totals while retaining its order.

Parameters:
  • show – False or None hides the group decoration, preserving ordering.

  • dendrogram_key – Stored Scanpy tree key, or the default grouping key.

  • size – Tree track size in inches at 100 logical pixels/inch.

Returns:

This builder for further chaining.

Raises:
  • TypeError – If flags or the tree key have invalid types.

  • ValueError – If the tree or size is invalid.

Example

>>> chart = plot.add_dendrogram().swap_axes().to_chart()
add_totals(*, show=True, sort=None, size=0.8, color=None)View on GitHub

Show group counts with native bars, replacing the dendrogram track.

Parameters:
  • show – False or None hides the decoration while preserving ordering.

  • sort – Sort groups by cell count, or retain their current order.

  • size – Track size in inches at 100 logical pixels/inch.

  • color – One CSS color or one per displayed group; default salmon.

Returns:

This builder for further chaining.

Raises:

Example

>>> chart = plot.add_totals(sort="descending", color="salmon").to_chart()
swap_axes(*, swap_axes=True)View on GitHub

Place groups on x and features on y, or restore the original orientation.

Parameters:

swap_axes – True transposes the plot; False or None restores it.

Returns:

This builder for further chaining.

Raises:

TypeError – If swap_axes is not boolean or None.

Example

>>> chart = plot.swap_axes().to_chart()
genome_spy.integrations.scanpy.pl.clustermap(adata, obs_keys=None, *, use_raw=None, show=None, save=None, hover=True, zoom=False, show_values=False, highlight=False, width=None, height=None, **kwds)View on GitHub

Display individual cells and genes ordered by hierarchical clustering.

Description:

Reproduce supported Scanpy/Seaborn clustermap computations with public SciPy linkage and native tiles. This plotting-only clustering does not write AnnData or rerun analysis. Supplied linkage is authoritative. The preview uses a native magma palette and a color guide on the right; it returns a GenomeSpy chart rather than Seaborn’s ClusterGrid.

Parameters:
  • adata – Resident AnnData; subset cells and genes before plotting.

  • obs_keys – One categorical observation column for a row color strip and native legend.

  • use_raw – Use raw expression when present by default, matching Scanpy.

  • show – Display once if true; return a chart if false; None uses Scanpy’s setting.

  • save – None or False; use chart.save for HTML or JSON.

  • hover – Show native tile and observation-strip tooltips.

  • zoom – Enable y-only zoom and pan with True, or both axes with “xy”.

  • show_values – Show plotted values when enough space is available in each tile.

  • highlight – False disables feedback; True shows a ruler; “outline” outlines a hovered tile.

  • width – Matrix width in logical pixels, excluding trees and labels.

  • height – Matrix height in logical pixels, excluding trees and labels.

  • **kwds – Supported Seaborn options: method, metric, z_score, standard_scale, row_cluster, col_cluster, row_linkage, col_linkage, row_colors, col_colors, mask, figsize, dendrogram_ratio, colors_ratio, xticklabels, yticklabels, cmap, vmin, vmax, linewidths, linecolor, cbar_pos (default or None), and cbar_kws (label only).

Returns:

A native chart, or None after display.

Raises:

Example

>>> import scanpy as sc
>>> import genome_spy.integrations.scanpy as gsc
>>> pbmc = sc.datasets.pbmc68k_reduced()
>>> chart = gsc.pl.clustermap(
...     pbmc[:, ["CD79A", "MS4A1", "CD3D"]],
...     obs_keys="bulk_labels", use_raw=False, show=False,
... )
genome_spy.integrations.scanpy.pl.correlation_matrix(adata, groupby, *, show_correlation_numbers=False, dendrogram=None, figsize=None, show=None, save=None, vmin=None, vmax=None, vcenter=None, norm=None, hover=True, show_values=None, width=None, height=None, **kwds)View on GitHub

Plot Python-computed group correlations with an optional aligned tree.

Reuses Scanpy’s stored dendrogram correlations and returns native tiles, labels, numbers and rules. Correlations come from the tree’s representation, not the selected markers of a dotplot or matrixplot. No embedding, PCA, gene ranking or cache writes run. Missing trees delegate to sc.tl.dendrogram with a guard against hidden PCA; existing results are never recomputed.

Parameters:
  • adata – AnnData with categorical groups and an existing representation.

  • groupby – Categorical observation key.

  • show_correlation_numbers – Scanpy name for fitted two-decimal tile labels.

  • dendrogram – None/True attaches a left tree and orders both axes by leaves. A string selects its cache key. False retains category order without drawing the tree; correlations still use the tree computation.

  • figsize – Native budget in inches at 100 logical pixels/inch, subtracting 180 pixels for an attached tree and 20 for the color guide. Labels and padding add space. Conflicts with width/height.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – Only inactive None/False; use native chart HTML/JSON saving.

  • vmin – Numeric lower color bound; defaults to -1 if both bounds are absent.

  • vmax – Numeric upper color bound; defaults to 1 if both bounds are absent.

  • vcenter – Reserved; nondefault values error.

  • norm – Reserved; Matplotlib normalization objects error.

  • hover – Show the row group, column group and exact correlation.

  • show_values – Common matrix option for fitted tile labels. None follows show_correlation_numbers; False conflicts with that flag set True.

  • width – Tile plot-area width, default 60 logical pixels per group.

  • height – Tile plot-area height, default 60 logical pixels per group.

  • **kwds – Native cmap, scalar edgecolors and linewidth. Default colors use reversed native redblue for negative-blue/positive-red values. Edges are black at 0.01 points, hidden above 30 groups.

Returns:

A detached native chart when show=False, otherwise None.

Raises:
  • ImportError – If Scanpy 1.11.5 is unavailable.

  • TypeError – If options or representation storage are unsupported.

  • ValueError – If groups, profiles, cache or dimensions are invalid.

  • NotImplementedError – If a rendering option is unsupported.

Example

>>> chart = gsc.pl.correlation_matrix(
...     pbmc, "bulk_labels", show_values=True, show=False
... )
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.dendrogram(adata, groupby, *, dendrogram_key=None, orientation='top', remove_labels=False, show=None, save=None, width=None, height=None)View on GitHub

Render group linkage computed in Python with native GenomeSpy rules.

Read the geometry and order stored by sc.tl.dendrogram. Missing trees delegate to that public computation with inplace=False, using resident dense X for small matrices or existing dense X_pca otherwise. Plotting never fits PCA, writes a cache or recomputes an existing result. Recompute explicitly in Scanpy after changing the data or grouping.

Parameters:
  • adata – AnnData with categorical groups and an existing representation.

  • groupby – Categorical observation key; categorical key sequences also work.

  • dendrogram_key – Stored uns key, default dendrogram_<groupby>. Missing keys compute through Scanpy without writing to AnnData.

  • orientation – Top, bottom, left or right tree orientation.

  • remove_labels – Hide leaf labels while preserving leaf geometry.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – Only inactive None/False; use native chart HTML/JSON saving.

  • width – Native plot-area width in logical pixels, default 300.

  • height – Native plot-area height in logical pixels, default 300.

Returns:

A detached native chart when show=False, otherwise None.

Raises:

Example

>>> chart = gsc.pl.dendrogram(pbmc, "bulk_labels", show=False)
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.dotplot(adata, var_names, groupby, *, use_raw=None, log=False, num_categories=7, categories_order=None, expression_cutoff=0.0, mean_only_expressed=False, standard_scale=None, title=None, colorbar_title='Mean expression', size_title='Cells expressing (%)', figsize=None, dendrogram=False, gene_symbols=None, var_group_positions=None, var_group_labels=None, var_group_rotation=None, layer=None, swap_axes=False, dot_color_df=None, show=None, save=None, vmin=None, vmax=None, vcenter=None, norm=None, cmap='Reds', dot_max=None, dot_min=None, smallest_dot=0.0, hover=True, zoom=False, highlight=False, group_gap=0, width=None, height=None, **kwds)View on GitHub

Plot grouped mean expression and the fraction of expressing cells.

Reads selected values through Scanpy’s public getter and computes detached summaries in Python. GenomeSpy renders the dots, labels, brackets and guides. No analysis, AnnData mutation, or Matplotlib rendering occurs.

Parameters:
  • adata – AnnData containing expression and grouping annotations.

  • var_names – Feature keys, repeated slots, or labeled feature groups.

  • groupby – Observation key or categorical grouping keys.

  • use_raw – Use raw by default when available; layer overrides that default.

  • log – Apply log1p before calculating means and expression fractions.

  • num_categories – Number of bins for numeric grouping annotations.

  • categories_order – Complete order of the grouping categories.

  • expression_cutoff – Strict lower threshold for an expressed value.

  • mean_only_expressed – Average only expressed values, with empty means zero.

  • standard_scale – Min–max scale means per variable or group.

  • title – Plot title.

  • colorbar_title – Color guide title, default “Mean expression”; None omits the title.

  • size_title – Percentage guide title, default “Cells expressing (%)”; None omits the title.

  • figsize – Native layout budget in inches at 100 logical pixels/inch. Width includes a fixed 150-pixel guide allowance; height sizes the plot area. Labels and renderer padding add space. Cannot be combined with width or height. No Matplotlib settings are consulted.

  • dendrogram – Attach a stored Scanpy tree or compute one through Scanpy. True uses the default cache key; a string selects another key.

  • gene_symbols – Variable annotation column for symbol lookup.

  • var_group_positions – Inclusive feature-slot bracket endpoints.

  • var_group_labels – Bracket labels; mappings already supply these.

  • var_group_rotation – Bracket label rotation in degrees.

  • layer – Expression layer instead of the automatic raw/X source.

  • swap_axes – Place groups on x and features on y.

  • dot_color_df – Authoritative labeled colors; scaling follows Scanpy 1.11.5.

  • show – Display once, return the chart when False, or use Scanpy autoshow.

  • save – Only inactive None/False; use the returned chart’s HTML/JSON saving.

  • vmin – Numeric lower color bound.

  • vmax – Numeric upper color bound.

  • vcenter – Reserved; nondefault values error.

  • norm – Reserved; Matplotlib normalization objects error.

  • cmap – GenomeSpy scheme name; the default Reds selects native reds.

  • dot_max – Upper clipped fraction, or the observed maximum rounded up to 0.1.

  • dot_min – Lower clipped fraction, default zero.

  • smallest_dot – Minimum dot area in points squared; maximum is 200.

  • hover – Show gene, group, displayed color value and expressing percentage.

  • zoom – True enables y-only zoom/panning; “xy” also enables x navigation.

  • highlight – False disables feedback; True shows a ruler; “outline” outlines a hovered dot.

  • group_gap – Space between marker blocks in pixels; 0 keeps slots contiguous.

  • width – Native plot-area width in logical pixels, default 37 per column.

  • height – Native plot-area height in logical pixels, default 35 per row.

  • **kwds – Only scalar linewidth is supported; other scatter options error.

Returns:

A detached native chart when show=False, otherwise None.

Raises:
  • ImportError – If Scanpy 1.11.5 is unavailable.

  • TypeError – If input types or forwarded options are invalid.

  • ValueError – If groups, supplied labels, bounds or sizes are invalid.

  • NotImplementedError – If a rendering option is unsupported.

Example

>>> chart = gsc.pl.dotplot(pbmc, ["CD79A", "CD3D"], "louvain", show=False)
>>> chart.save("markers.html", inline=True)
genome_spy.integrations.scanpy.pl.heatmap(adata, var_names, groupby, *, use_raw=None, log=False, num_categories=7, dendrogram=False, gene_symbols=None, var_group_positions=None, var_group_labels=None, var_group_rotation=None, layer=None, standard_scale=None, swap_axes=False, show_gene_labels=None, show=None, save=None, figsize=None, vmin=None, vmax=None, vcenter=None, norm=None, hover=True, zoom=False, show_values=False, highlight=False, group_gap=0, width=None, height=None, **kwds)View on GitHub

Plot individual cells’ expression with Scanpy-compatible ordering.

Description:

Read selected values using Scanpy’s public getter. Apply log1p and optional cell/gene scaling before sorting cells by category. Render native tiles, category strips, marker annotations and optional stored dendrograms. Colors use cell values; embeddings and rankings are not rerun.

Parameters:
  • adata – Annotated expression data.

  • var_names – Gene keys or a marker dictionary; repeated genes retain slots.

  • groupby – Observation annotation or annotations defining cell order.

  • use_raw – Use raw by default when available and no layer is requested.

  • log – Apply log1p to cell values before scaling and sorting.

  • num_categories – Number of bins for a numeric grouping column.

  • dendrogram – Attach a tree, optionally naming its stored result.

  • gene_symbols – Variable annotation containing the requested symbols.

  • var_group_positions – Inclusive gene positions for marker annotations.

  • var_group_labels – Labels for those marker annotations.

  • var_group_rotation – Rotation of marker labels above an ordinary heatmap.

  • layer – Expression layer; incompatible with explicit use_raw=True.

  • standard_scale – Scale values to 0–1 per gene (“var”) or cell (“obs”).

  • swap_axes – Place cells on x and genes on y.

  • show_gene_labels – Default to showing labels for at most 50 genes.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use the returned chart’s HTML/JSON export.

  • figsize – Compatible overall size in inches; native dimensions use pixels.

  • vmin – Lower continuous color bound.

  • vmax – Upper continuous color bound.

  • vcenter – Nondefault values are unsupported.

  • norm – Matplotlib normalization objects are unsupported.

  • hover – Include cell ID, gene, group and expression tooltips, including category-strip tooltips.

  • zoom – True enables y-only zoom/panning; “xy” also enables x navigation.

  • show_values – Show plotted values to two decimals when cells have enough room.

  • group_gap – Space between cell groups and marker blocks in CSS pixels; defaults to 0. Set a positive width to separate groups.

  • highlight – False disables feedback; True shows a ruler; “outline” outlines a hovered tile.

  • width – Native tile-area width in pixels.

  • height – Native tile-area height in pixels.

  • **kwds – Native cmap scheme, scalar alpha and interpolation=”nearest”.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If an option, source or forwarded keyword is unsupported.

  • ValueError – If values, groups, labels, bounds or plot size are invalid.

  • NotImplementedError – If normalization or interpolation is unsupported.

Example

>>> chart = gsc.pl.heatmap(
...     pbmc, ["CD79A", "CD3D"], "bulk_labels", show=False
... )
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.tracksplot(adata, var_names, groupby, *, use_raw=None, log=False, dendrogram=False, gene_symbols=None, var_group_positions=None, var_group_labels=None, layer=None, show=None, save=None, figsize=None, hover=True, zoom=False, group_gap=0, spacing=0, width=None, height=None, **kwds)View on GitHub

Plot cell-level expression tracks ordered by a categorical annotation.

Description:

Read selected genes through Scanpy’s public getter, preserving raw/layer precedence and cell order within groups. Each cell is one native rect, giving stepped profiles rather than Scanpy’s fill between adjacent values. Optional trees reuse stored linkage or Scanpy’s existing tree helper; plotting never fits embeddings or rankings. Read only selected resident expression without changing AnnData.

Parameters:
  • adata – Annotated expression data.

  • var_names – Gene keys or a marker dictionary; repeated genes retain tracks.

  • groupby – Categorical observation column defining cell order and colors.

  • use_raw – Use raw by default when available and no layer is requested.

  • log – Apply log1p to values, then use logarithmic y-axes, as in Scanpy.

  • dendrogram – Attach a group tree, optionally naming a stored result.

  • gene_symbols – Variable annotation containing requested gene symbols.

  • var_group_positions – Inclusive marker spans, covering all genes in order.

  • var_group_labels – Labels defining those marker groups.

  • layer – Expression layer; incompatible with explicit use_raw=True.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use the returned chart’s HTML/JSON export.

  • figsize – Overall size in inches; cannot be combined with native dimensions.

  • hover – Include cell ID, label, group, gene and plotted-value tooltips.

  • zoom – Enable linked x-only zoom and panning across cells.

  • group_gap – Space between cell groups in pixels; defaults to 0.

  • spacing – Space between tracks, the tree and category strip in pixels.

  • width – Track plotting width in pixels; defaults to 1200.

  • height – Combined expression-track height in pixels; defaults to 25 per gene.

  • **kwds – Forwarded styling is unsupported and fails by name.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If options or expression storage are unsupported.

  • ValueError – If groups, values, sources, marker spans or dimensions are invalid.

  • NotImplementedError – If marker spans do not partition the requested genes.

Example

>>> chart = gsc.pl.tracksplot(
...     pbmc, ["CD79A", "CD3D"], "bulk_labels", zoom=True, show=False
... )
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.matrix(matrix, *, xlabel=None, ylabel=None, xticks=None, yticks=None, title=None, colorbar_shrink=0.5, color_map=None, show=None, save=None, hover=True, zoom=False, show_values=False, highlight=False, width=None, height=None)View on GitHub

Display a supplied numeric matrix in its original row and column order.

Description:

Reproduce Scanpy’s matrix helper using native tiles and a linear color guide. No AnnData access, aggregation or clustering occurs. Missing and masked entries stay blank; color bounds follow the finite input range. Matplotlib axes, image objects and colormap objects are unsupported.

Parameters:
  • matrix – Resident 2D numeric array, nested sequence or DataFrame.

  • xlabel – Label below the x axis.

  • ylabel – Label beside the y axis.

  • xticks – One label per column; repeated labels retain separate slots.

  • yticks – One label per row; repeated labels retain separate slots.

  • title – Plot title.

  • colorbar_shrink – Color guide length relative to plot height.

  • color_map – Native GenomeSpy scheme; None uses viridis.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use the returned chart’s HTML/JSON export.

  • hover – Include row, column and numeric value tooltips.

  • zoom – True enables y-only zoom/panning; “xy” also enables x navigation.

  • show_values – Show plotted values to two decimals when cells have enough room.

  • highlight – False disables feedback; True shows a ruler; “outline” outlines a hovered tile.

  • width – Native tile-area width in pixels.

  • height – Native tile-area height in pixels.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If the source or label form is unsupported.

  • ValueError – If shape, numeric values, tick counts or sizes are invalid.

  • NotImplementedError – If image saving or a nonnative color scheme is requested.

Example

>>> chart = gsc.pl.matrix(
...     [[0, 1], [2, 3]], xticks=["A", "B"], show=False
... )
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.timeseries_as_heatmap(X, *, var_names=(), highlights_x=(), color_map=None, show=None, save=None, hover=True, zoom=False, show_values=False, width=None, height=None)View on GitHub

Display supplied ordered profiles as a variable-by-sample heatmap.

Description:

Reuse the matrix renderer without sorting, normalizing or computing time. Match Scanpy’s transpose, first variable at the bottom, center-cropped limits and dashed highlights. Missing values stay blank. Matplotlib colormap objects and global figure settings are unsupported.

Parameters:
  • X – Resident numeric matrix with samples in rows and variables in columns.

  • var_names – Variable labels; empty uses positions, 2D uses the first column.

  • highlights_x – Finite sample positions for dashed vertical rules.

  • color_map – Native GenomeSpy scheme; None uses viridis.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use the returned chart’s HTML/JSON export.

  • hover – Include row (variable), column (sample position) and value tooltips.

  • zoom – True enables y-only zoom/panning; “xy” also enables x navigation.

  • show_values – Show values to two decimals when cells have enough room.

  • width – Native tile-area width in pixels, default 372.

  • height – Native tile-area height in pixels, default 616.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If the source, labels or flags are unsupported.

  • ValueError – If values, shape, labels, highlights or sizes are invalid.

  • NotImplementedError – If saving or a nonnative color scheme is requested.

Example

>>> chart = gsc.pl.timeseries_as_heatmap(
...     profiles, var_names=genes, zoom="xy", show=False
... )
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.timeseries(X, *, show=None, save=None, hover=True, zoom=False, series_select=False, ruler=False, width=None, height=None, **kwargs)View on GitHub

Plot supplied ordered profiles as points, as Scanpy’s timeseries helper does.

Description:

Preserve supplied time coordinates, sample order and subset draw order. No sorting by time, line interpolation, smoothing or analysis runs. Multi-column inputs use palette colors; a single column requires color. Floating color values are continuous; other sortable values define groups.

Parameters:
  • X – Resident numeric vector or samples-by-variables matrix/table.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use the native chart’s HTML/JSON export.

  • hover – Show series, source sample position, time, value and numeric color.

  • zoom – Enable native wheel zoom and drag panning on both axes.

  • series_select – Add a dropdown to emphasize one series without filtering samples.

  • ruler – Show a native cursor for reading time positions.

  • width – Native plot-area width in pixels, default 992.

  • height – Native plot-area height in pixels, default 739.2.

  • **kwargs – Scanpy’s time=None, color=None, var_names=(), highlights_x=(), xlabel=””, ylabel=”gene expression”, yticks=None, xlim=None, legend=True, palette=None, color_map=”viridis”, marker=”.”. Palette accepts CSS color sequences; color_map uses native schemes. Markers reuse the supported embedding shapes; different per-subset shapes, repeated labels and Matplotlib axes/cyclers are unsupported.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If arguments, numeric sources or vectors are unsupported.

  • ValueError – If shapes, labels, colors, bounds or sizes are invalid.

  • NotImplementedError – If native rendering cannot preserve an option.

Example

>>> chart = gsc.pl.timeseries(
...     profiles, time=times, var_names=genes, zoom=True, show=False
... )
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.timeseries_subplot(X, *, time=None, color=None, var_names=(), highlights_x=(), xlabel='', ylabel='gene expression', yticks=None, xlim=None, legend=True, palette=None, color_map='viridis', marker='.', show=None, save=None, hover=True, zoom=False, series_select=False, ruler=False, width=None, height=None, **kwargs)View on GitHub

Build a supplied-profile point panel for native chart composition.

Description:

Use the same preparation and renderer as timeseries, preserving supplied time, sample order and color subsets. Compose returned panels with genome_spy.hconcat/vconcat; no current figure or Matplotlib axes are used.

Parameters:
  • X – Resident numeric vector or samples-by-variables matrix/table.

  • time – Supplied sample coordinates; None uses positions.

  • color – Single-variable sample colors; floating first values are continuous.

  • var_names – Distinct series or category labels; empty hides the legend.

  • highlights_x – Finite positions for clipped dashed vertical rules.

  • xlabel – Horizontal axis label.

  • ylabel – Vertical axis label.

  • yticks – Explicit finite ticks, expanding the vertical limits if needed.

  • xlim – Explicit finite horizontal limits, including reversed limits.

  • legend – Show the native series guide when var_names is supplied.

  • palette – CSS color sequence for variables or single-variable categories.

  • color_map – Native scheme for continuous single-variable colors.

  • marker – Shared native marker, or an identical marker per subset.

  • show – Use Scanpy autoshow when unset; False returns a composable chart.

  • save – Only None/False; use the native chart’s HTML/JSON export.

  • hover – Show series, source position, time, value and numeric color.

  • zoom – Enable native wheel zoom and panning on both axes.

  • series_select – Add a dropdown to emphasize one series without filtering samples.

  • ruler – Show a native cursor for reading time positions.

  • width – Native plot-area width in pixels, default 496.

  • height – Native plot-area height in pixels, default 369.6.

  • **kwargs – Unsupported keywords fail clearly; ax and return_fig are omitted.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If arguments, sources or plotting options are unsupported.

  • ValueError – If shapes, labels, bounds or dimensions are invalid.

  • NotImplementedError – If native rendering cannot preserve an option.

Example

>>> left = gsc.pl.timeseries_subplot(profiles, show=False)
>>> right = gsc.pl.timeseries_subplot(other_profiles, show=False)
>>> chart = gs.hconcat(left, right).resolve_scale(default="independent")
genome_spy.integrations.scanpy.pl.sim(adata, *, tmax_realization=None, as_heatmap=False, shuffle=False, show=None, save=None, marker='.', hover=True, zoom=False, show_values=False, series_select=False, ruler=False, run_select=False, connect=False, width=None, height=None)View on GitHub

Plot supplied simulation realizations with the existing time-series charts.

Description:

Read X and var_names without running simulation or changing AnnData. Realization length comes from tmax_realization, then uns[‘tmax_write’], then n_obs. It sets boundaries and one-based tick labels, never truncates X. Shuffle uses Scanpy’s seed-1 permutation without changing global random state; as in Scanpy, shuffled output is always points.

Parameters:
  • adata – AnnData containing resident dense samples-by-variables X.

  • tmax_realization – Positive observations per realization; None uses metadata.

  • as_heatmap – Use the existing heatmap renderer unless shuffle is True.

  • shuffle – Permute all observations deterministically before point plotting.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use native chart HTML/JSON saving.

  • marker – Supported shared point marker; unused for heatmap output.

  • hover – Show the existing time-series value tooltips.

  • zoom – True navigates both point axes or heatmap y; ‘xy’ navigates both.

  • show_values – Fit numeric labels inside heatmap cells; points reject True.

  • series_select – Add a dropdown to emphasize one gene in points or heatmap.

  • ruler – Show a native cursor for reading sample positions.

  • run_select – Add a run dropdown; unavailable for shuffled samples.

  • connect – Join adjacent simulation samples within each run; point output only. Missing values leave gaps. Never connects different runs.

  • width – Native plot-area width; defaults to the selected time-series chart.

  • height – Native plot-area height; defaults to the selected time-series chart.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If flags, AnnData or expression storage are unsupported.

  • ValueError – If realization length, profiles, labels or dimensions are invalid.

  • NotImplementedError – If a requested native style or delivery is unsupported.

Example

>>> simulation = sc.datasets.krumsiek11()[:, ["Gata2", "Gata1", "Pu.1"]]
>>> chart = gsc.pl.sim(simulation, tmax_realization=160, show=False)
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.dpt_groups_pseudotime(adata, *, color_map=None, palette=None, show=None, save=None, marker='.', hover=True, zoom=False, width=None, height=None)View on GitHub

Compare stored DPT groups and pseudotime in two native time-series panels.

Description:

Read categorical dpt_groups, dpt_order, dpt_pseudotime and stored dpt_changepoints without reading expression or running analysis. Preserve category codes and supplied order coordinates. Palette assignment follows Scanpy’s sorted observed groups, with a native DPT group legend. The lower panel colors by pseudotime, with a colorbar for continuous values. Missing or infinite pseudotimes are omitted from the lower panel only.

Parameters:
  • adata – AnnData with the stored DPT observation fields and boundaries.

  • color_map – Native lower-panel color scheme; None uses viridis.

  • palette – CSS color sequence for observed groups; None uses Scanpy’s Vega 10.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use native chart HTML/JSON saving.

  • marker – Supported shared point marker; differing per-group shapes reject.

  • hover – Show the existing time-series sample, order and value tooltips.

  • zoom – Enable independent native x/y zoom and pan in each panel.

  • width – Each panel’s plot-area width in pixels, default 496.

  • height – Each panel’s plot-area height in pixels, default 168.

Returns:

A native two-panel chart for show=False, otherwise displays and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If metadata types, flags or native styles are unsupported.

  • ValueError – If stored fields, order, values, palettes or dimensions are invalid.

  • NotImplementedError – If native rendering cannot preserve a plotting option.

Example

>>> sc.tl.dpt(adata, n_branchings=1)
>>> chart = gsc.pl.dpt_groups_pseudotime(adata, zoom=True, show=False)
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.dpt_timeseries(adata, *, color_map=None, show=None, save=None, as_heatmap=True, marker='.', hover=True, zoom=False, show_values=False, width=None, height=None)View on GitHub

Plot expression in saved DPT order using the existing time-series charts.

Description:

Index resident dense X with stored dpt_order_indices and retain saved dpt_changepoints. No trajectory analysis, sorting, smoothing or scaling runs. Heatmap and point modes reuse their existing preparation/renderers. Raw and layers are unused, as in Scanpy.

Parameters:
  • adata – AnnData with resident dense X and stored DPT indices/boundaries.

  • color_map – Native heatmap scheme; None uses viridis. Unused for points.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use the native chart’s HTML/JSON saving.

  • as_heatmap – Draw a variable-by-ordered-observation heatmap; False uses points.

  • marker – Shared native point marker; unused in heatmap mode.

  • hover – Show variable, ordered sample position and value tooltips.

  • zoom – True navigates heatmap y or both point axes; ‘xy’ navigates both.

  • show_values – Fit values inside heatmap cells; points reject True.

  • width – Native plot-area width; defaults to the selected time-series chart.

  • height – Native plot-area height; defaults to the selected time-series chart.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional Scanpy version is unavailable.

  • TypeError – If flags, AnnData or expression storage are unsupported.

  • ValueError – If saved indices, profiles, boundaries or dimensions are invalid.

  • NotImplementedError – If native rendering cannot preserve a plotting option.

Example

>>> sc.tl.dpt(adata, n_branchings=1)
>>> chart = gsc.pl.dpt_timeseries(adata[:, genes], zoom="xy", show=False)
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.paga(adata, *, threshold=None, color=None, layout=None, layout_kwds=mappingproxy({}), init_pos=None, root=0, labels=None, single_component=False, solid_edges='connectivities', dashed_edges=None, transitions=None, fontsize=None, fontweight='bold', fontoutline=None, text_kwds=mappingproxy({}), node_size_scale=1.0, node_size_power=0.5, edge_width_scale=1.0, min_edge_width=None, max_edge_width=None, arrowsize=30, title=None, left_margin=0.01, random_state=0, pos=None, normalize_to_color=False, cmap=None, colorbar=None, cb_kwds=mappingproxy({}), frameon=None, add_pos=True, export_to_gexf=False, use_raw=True, colors=None, groups=None, plot=True, show=None, save=None, hover=True, zoom=False, width=None, height=None, palette=None, edge_slider=False, show_node_labels=True, **kwargs)View on GitHub

Draw stored undirected PAGA connectivity graphs with native nodes and edges.

Description:

Read saved PAGA matrices and groups; gene colors read only the requested expression column. Never rerun PAGA analysis. Supplied positions are retained; otherwise Scanpy’s public plot=False path computes the layout on a metadata-only object without creating a figure. Native rules, points and text draw the result.

Parameters:
  • adata – AnnData with stored PAGA graphs and categorical observation groups.

  • threshold – Drop weights below this value; None uses 0.01, zero retains zeros.

  • color – Group key, numeric observation key, gene, degree_solid/degree_dashed, CSS color or one CSS color per node. None uses group colors.

  • layout – Scanpy layout, computed only when pos is None.

  • layout_kwds – Keywords passed to Scanpy’s public layout computation.

  • init_pos – Initial layout coordinates; unused when pos is supplied.

  • root – Scanpy tree-layout root; unused when pos is supplied.

  • labels – One string per node; None uses category labels.

  • single_component – Show only the largest thresholded solid component; ties keep the first group order. Filtering requires dashed_edges=None.

  • solid_edges – Stored PAGA matrix key for black solid edges.

  • dashed_edges – Optional stored matrix key for gray dashed edges.

  • transitions – Unsupported directed-edge mode.

  • fontsize – Native label size in points; None uses 10.

  • fontweight – Native ‘normal’ or ‘bold’ label weight.

  • fontoutline – Unsupported label outline.

  • text_kwds – Only empty; use native chart styling for supported customization.

  • node_size_scale – Multiply Scanpy’s node areas by this nonnegative value.

  • node_size_power – Exponent of stored size divided by its median.

  • edge_width_scale – Multiply default 7.5-point weight-scaled widths.

  • min_edge_width – Minimum solid-edge width in points.

  • max_edge_width – Maximum solid/dashed width in points.

  • arrowsize – Inactive without transitions.

  • title – Optional plot title.

  • left_margin – Only the pinned default; width/height set native dimensions.

  • random_state – Scanpy layout seed.

  • pos – Two coordinates per node; file-based positions are unsupported.

  • normalize_to_color – Inactive without categorical mixtures.

  • cmap – Native continuous scheme, default viridis; inactive for CSS colors.

  • colorbar – None or True shows a native guide for numeric node colors. False hides that guide. Group colors have a native categorical legend.

  • cb_kwds – Only empty in this preview.

  • frameon – Draw the native view frame; None uses Scanpy’s frame setting.

  • add_pos – Store successful positions in uns[‘paga’][‘pos’], as in Scanpy.

  • export_to_gexf – Unsupported; never writes an implicit graph file.

  • use_raw – Use raw gene expression when present, otherwise X; False uses X. Inactive for metadata and degree colors.

  • colors – Legacy alias overriding color when supplied.

  • groups – Deprecated alias overriding labels when supplied.

  • plot – False computes/caches positions without constructing a chart.

  • show – Use Scanpy autoshow when unset; False returns the native chart.

  • save – Only None/False; use native HTML/JSON saving.

  • hover – Show group/cell counts, numeric color values and edge weights.

  • zoom – Enable native x/y wheel zoom and pan.

  • width – Native plot width in pixels, default 548.

  • height – Native plot height in pixels, default 384.

  • palette – Native addition: CSS category colors/mapping or native scheme for group colors. None reuses saved colors; inactive for other colors.

  • edge_slider – Add a slider that hides displayed edges below a weight cutoff. It does not recover edges excluded by threshold or recompute node statistics.

  • show_node_labels – Show native labels that make room for nodes and each other. False keeps group names on hover.

  • **kwargs – Unsupported keywords fail clearly, including ax/cax.

Returns:

A native chart for show=False; otherwise None, including plot=False.

Raises:
  • ImportError – If the optional Scanpy/PAGA dependencies are unavailable.

  • TypeError – If flags, metadata or native options are unsupported.

  • ValueError – If stored graphs, positions, sizes or labels are invalid.

  • NotImplementedError – If a requested color, edge or styling mode is unsupported.

Example

>>> sc.tl.paga(adata, groups="louvain")
>>> chart = gsc.pl.paga(adata, zoom=True, show=False)
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.paga_adjacency(adata, *, adjacency='connectivities', adjacency_tree='connectivities_tree', as_heatmap=True, color_map=None, show=None, save=None, hover=True, zoom=False, show_values=False, labels=None, width=None, height=None)View on GitHub

Display stored PAGA adjacency as a matrix or connectivity stripplot.

Description:

Read top-level uns matrices, as Scanpy’s legacy entry does. Reuse native matrix tiles, color guides and navigation without reading expression, computing PAGA or changing AnnData. Dots mark tree nonzero entries at x=row, y=column, preserving Scanpy’s orientation. Stripplot mode shows off-diagonal connectivity in light gray and tree-selected values in blue. Points grow gently on zoom; heatmap dots stay inside their cells.

Parameters:
  • adata – AnnData containing the explicitly stored adjacency matrices.

  • adjacency – Top-level uns key for the sparse numeric matrix.

  • adjacency_tree – Top-level uns key for the sparse tree matrix.

  • as_heatmap – True shows matrix tiles; False shows connectivity by source group.

  • color_map – Native heatmap scheme; None uses viridis. Inactive for stripplots.

  • show – Display according to Scanpy’s autoshow when unset.

  • save – Only None/False; use native HTML/JSON export.

  • hover – Include matrix-value, tree-edge or stripplot connectivity tooltips.

  • zoom – True enables y navigation; “xy” enables both axes.

  • show_values – Show fitted heatmap values; requires as_heatmap=True.

  • labels – Explicit group labels in adjacency row/column order; None keeps indices.

  • width – Native plot width in pixels.

  • height – Native plot height in pixels.

Returns:

A native chart for show=False, otherwise displays it and returns None.

Raises:
  • ImportError – If the optional supported Scanpy version is unavailable.

  • TypeError – If AnnData, keys, matrix values or native options have unsupported types.

  • ValueError – If matrices are missing, mismatched, infinite or too large.

  • NotImplementedError – If stripplot cell labels, image saving or a nonnative heatmap scheme is requested.

Example

>>> adata.uns["connectivities"] = adata.uns["paga"]["connectivities"]
>>> adata.uns["connectivities_tree"] = adata.uns["paga"]["connectivities_tree"]
>>> chart = gsc.pl.paga_adjacency(adata, show=False)
genome_spy.integrations.scanpy.pl.paga_compare(adata, basis=None, *, edges=False, color=None, alpha=None, groups=None, components=None, projection='2d', legend_loc='on data', legend_fontsize=None, legend_fontweight='bold', legend_fontoutline=None, color_map=None, palette=None, frameon=False, size=None, title=None, right_margin=None, left_margin=0.05, show=None, save=None, title_graph=None, groups_graph=None, pos=None, hover=True, zoom=False, width=None, height=None, **paga_graph_params)View on GitHub

Compare a stored embedding and its PAGA graph in aligned native panels.

Description:

Reuse the embedding and PAGA plotting entries without computing analysis. With the PAGA group color, omitted positions are group medians in the selected embedding components. Other colors use cached PAGA positions. Both panels share the embedding limits and optional navigation. Colors and point sizes stay independent; the group key sits below both views.

Parameters:
  • adata – AnnData with stored embedding coordinates and PAGA results.

  • basis – Stored basis; None prefers draw_graph_fa, umap, tsne, draw_graph_fr.

  • edges – Show the stored observation-neighbor graph in the embedding panel.

  • color – One observation key or gene; None uses the stored PAGA group key.

  • alpha – Embedding point opacity; None uses the shared embedding default.

  • groups – Categories highlighted in the embedding; graph groups are unchanged.

  • components – One one-based coordinate pair, for example “2,3”.

  • projection – Only the default two-dimensional projection is supported.

  • legend_loc – Embedding guide location, defaulting to group-median labels.

  • legend_fontsize – Shared label size in points or a supported named size.

  • legend_fontweight – On-data labels require normal/400; the bold default remains unsupported with the bundled regular font atlas.

  • legend_fontoutline – Unsupported label outlines.

  • color_map – Native continuous embedding scheme; graph cmap is independent.

  • palette – CSS category colors/mapping or native scheme, shared by embedding and graph when color is the stored PAGA grouping.

  • frameon – Draw the native panel frames.

  • size – Embedding point areas in square points; None uses a compact area of 9. Points grow gently on zoom, up to twice their initial diameter.

  • title – Common title when title_graph is None; otherwise embedding title.

  • right_margin – Only None; native composition places the guides.

  • left_margin – Only the pinned default; native composition sets spacing.

  • show – Display once, return the chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • title_graph – Graph title; None selects a common title instead.

  • groups_graph – Graph node labels, overridden by labels in paga_graph_params.

  • pos – Supplied graph coordinates; None uses medians or cached positions.

  • hover – Enable the existing observation, node and edge tooltips.

  • zoom – Enable shared native x/y zoom and pan across the two panels.

  • width – Per-panel plot width in pixels, default 300.

  • height – Per-panel plot height in pixels, default 300.

  • **paga_graph_params – Supported paga options, including threshold and add_pos. The graph shows labels on hover unless show_node_labels=True or custom labels are supplied. Labels make room for each other and the nodes while zooming. edge_slider=True adds a stored-edge display filter. Parent rendering restrictions apply; plot=False is unsupported here.

Returns:

A horizontal native composition when show=False, otherwise None.

Raises:
  • ImportError – If the supported optional dependencies are unavailable.

  • TypeError – If the data or requested options have invalid types.

  • ValueError – If required stored results or components are invalid.

  • NotImplementedError – If a parent rendering option or panel mode is unsupported.

Example

>>> sc.tl.paga(adata, groups="cell_type")
>>> chart = gsc.pl.paga_compare(
...     adata, basis="umap", legend_fontweight="normal", zoom=True, show=False
... )
genome_spy.integrations.scanpy.pl.paga_path(adata, nodes, keys, *, use_raw=True, annotations=('dpt_pseudotime',), color_map=None, color_maps_annotations=mappingproxy({'dpt_pseudotime': 'Greys'}), palette_groups=None, n_avg=1, groups_key=None, xlim=(None, None), title=None, left_margin=None, ytick_fontsize=None, title_fontsize=None, show_node_names=True, show_yticks=True, show_colorbar=True, legend_fontsize=None, legend_fontweight=None, normalize_to_zero_one=False, as_heatmap=True, return_data=False, show=None, save=None, hover=True, zoom=False, show_values=False, series_select=False, ruler=False, width=None, height=None)View on GitHub

Show expression along supplied PAGA groups using stored DPT pseudotime.

Description:

Order cells within each requested group, smooth the concatenated values, then optionally normalize each key. Reuse shared Scanpy data access and native matrix tiles with original group bands and numeric annotations. Analysis remains explicit; no embeddings, PAGA or DPT are recomputed. Heatmaps require two keys and two smoothed cells. Lines use native round-cap rules with minor stroke differences. Native Greys differs from Scanpy’s white-to-black annotation palette.

Parameters:
  • adata – AnnData with categorical groups and stored dpt_pseudotime.

  • nodes – Ordered group names or integer category indices; repeats are kept.

  • keys – Gene or numeric observation keys, retaining supplied order.

  • use_raw – Use raw when available, otherwise X, as in Scanpy.

  • annotations – Observation tracks; heatmaps support one numeric track. Lines show no tracks.

  • color_map – Native heatmap scheme; None uses viridis. Inactive for lines.

  • color_maps_annotations – Native schemes by annotation key; defaults to Greys.

  • palette_groups – CSS colors in full category order; None reuses saved/default colors.

  • n_avg – Full-window running average across concatenated cells.

  • groups_key – Group column; None reads uns[‘paga’][‘groups’].

  • xlim – Slice smoothed line samples, resetting x to zero; inactive for heatmaps.

  • title – Optional chart title.

  • left_margin – Only None; native layout reserves label space automatically.

  • ytick_fontsize – Gene and track label size in points.

  • title_fontsize – Title size in points.

  • show_node_names – Label the supplied groups on their color band.

  • show_yticks – Show key and track names.

  • show_colorbar – Show the native expression color guide.

  • legend_fontsize – Line legend font size in points or a standard name; inactive for heatmaps.

  • legend_fontweight – Inactive, as in Scanpy.

  • normalize_to_zero_one – Normalize each smoothed profile to zero through one.

  • as_heatmap – True shows tiles and tracks; False connects adjacent samples with rules.

  • return_data – Return the prepared table with the chart, or after display.

  • show – Use Scanpy autoshow when unset; False returns the native chart.

  • save – Only None/False; use native HTML/JSON export.

  • hover – Include value and annotation tooltips.

  • zoom – True navigates y; “xy” navigates both axes and aligned tracks.

  • series_select – Add a dropdown to emphasize one plotted key.

  • ruler – Show a native cursor along the path.

  • show_values – Show fitted tile values; requires as_heatmap=True.

  • width – Native plot area width in pixels.

  • height – Native plot area height in pixels.

Returns:

A chart for show=False, otherwise None. With return_data=True, return (chart, table) for show=False, otherwise the table after displaying.

Raises:
  • ImportError – If the optional supported Scanpy version is unavailable.

  • TypeError – If option types, groups or values are unsupported.

  • ValueError – If metadata, node indices, bounds or window size are invalid.

  • NotImplementedError – If categorical/multiple heatmap tracks, repeated line keys, custom margins, image saving or nonnative heatmap colors are requested.

Example

>>> chart = gsc.pl.paga_path(adata, nodes=[0, 1], keys=["CD3D", "CD79A"], show=False)
genome_spy.integrations.scanpy.pl.matrixplot(adata, var_names, groupby, *, use_raw=None, log=False, num_categories=7, categories_order=None, figsize=None, dendrogram=False, title=None, cmap='viridis', colorbar_title='Mean expression\nin group', gene_symbols=None, var_group_positions=None, var_group_labels=None, var_group_rotation=None, layer=None, standard_scale=None, values_df=None, swap_axes=False, show=None, save=None, vmin=None, vmax=None, vcenter=None, norm=None, hover=True, zoom=False, show_values=False, highlight=False, width=None, height=None, **kwds)View on GitHub

Plot group mean expression as native GenomeSpy tiles.

Selected-data access, means and scaling run in Python, without modifying AnnData or invoking analysis. Chart construction shares dotplot’s native slots, labels and brackets. Supplied values bypass aggregation and scaling.

Parameters:
  • adata – AnnData with expression and grouping annotations.

  • var_names – Feature keys, repeated slots, or labeled feature groups.

  • groupby – Observation key or categorical grouping keys.

  • use_raw – Use raw by default when available; layer overrides that default.

  • log – Apply log1p before computing means; ignored for supplied values_df.

  • num_categories – Number of bins for numeric grouping annotations.

  • categories_order – Complete category order, also applied to values_df rows.

  • figsize – Native layout budget in inches at 100 logical pixels/inch. Width includes a 150-pixel guide allowance; height sizes the plot area. Labels and padding add space. Conflicts with width/height.

  • dendrogram – True or a cache key attaches a Python-computed group tree.

  • title – Plot title.

  • cmap – GenomeSpy color scheme name; None uses viridis.

  • colorbar_title – Color guide title; None removes its title.

  • gene_symbols – Variable annotation column for symbol lookup.

  • var_group_positions – Inclusive feature-slot bracket endpoints.

  • var_group_labels – Bracket labels; mappings supply these directly.

  • var_group_rotation – Bracket label rotation in degrees.

  • layer – Expression layer instead of the automatic raw/X source.

  • standard_scale – Min–max scale computed means per variable or group, once before swapping axes. Constant ranges become zero. Supplied values_df is never scaled.

  • values_df – Authoritative numeric table with exactly the plotted labels and feature multiplicities. Retains its row/column order unless categories_order reorders rows. Duplicate group labels error.

  • swap_axes – Place groups on x and features on y.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – Only inactive None/False; use native chart HTML/JSON saving.

  • vmin – Finite numeric lower color bound.

  • vmax – Finite numeric upper color bound.

  • vcenter – Reserved; nondefault values error.

  • norm – Reserved; Matplotlib normalization objects error.

  • hover – Show gene, group and displayed mean or supplied value.

  • zoom – True enables y-only zoom/panning; “xy” also enables x navigation.

  • show_values – Show plotted values to two decimals when cells have enough room.

  • highlight – False disables feedback; True shows a ruler; “outline” outlines a hovered tile.

  • width – Plot-area logical pixels, default 37 per feature column.

  • height – Plot-area logical pixels, default 35 per group row.

  • **kwds – Scalar edgecolor and linewidth. Defaults are gray edges at 0.1 points; edgecolor=”none” removes edges. Plural aliases and all other pcolor options error.

Returns:

A detached native chart when show=False, otherwise None.

Raises:
  • ImportError – If Scanpy 1.11.5 is unavailable.

  • TypeError – If input types or forwarded options are invalid.

  • ValueError – If groups, table labels, bounds or dimensions are invalid.

  • NotImplementedError – If a rendering option is unsupported.

Example

>>> chart = gsc.pl.matrixplot(
...     pbmc, ["CD79A", "CD3D"], "bulk_labels",
...     standard_scale="var", show=False,
... )
>>> chart.display(inline=True)
genome_spy.integrations.scanpy.pl.ranking(adata, attr, keys, *, dictionary=None, indices=None, labels=None, color='black', n_points=30, log=False, include_lowest=False, show=None, hover=True, width=None, height=None)View on GitHub

Plot ranked labels from scores already stored in AnnData.

Reads supplied attributes or nested dictionaries without computing analysis. Native text panels preserve Scanpy’s score sorting and extreme-rank gap.

Parameters:
  • adata – AnnData containing the scores.

  • attr – Attribute containing score columns or a dictionary.

  • keys – Score names, or an array key when selecting indices.

  • dictionary – Nested dictionary key within the attribute.

  • indices – Array columns to display as separate panels.

  • labels – Labels per score row, a numbered prefix, or automatic labels.

  • color – Opaque native CSS text color.

  • n_points – Rank count; Scanpy includes one extra label without include_lowest.

  • log – Take the natural logarithm of positive scores before sorting.

  • include_lowest – Show high and low scores with a gap when ranks are omitted.

  • show – Display once, or return the native chart when False.

  • hover – Show the label, score and zero-based rank in native tooltips.

  • width – Native width per panel, default 300 logical pixels.

  • height – Native height per panel, default 300 logical pixels.

Returns:

A native chart when show=False, otherwise None.

Raises:

Example

>>> chart = gsc.pl.ranking(adata, "varm", "PCs", indices=[0, 1], show=False)
genome_spy.integrations.scanpy.pl.rank_genes_groups(adata, groups=None, *, n_genes=20, gene_symbols=None, key='rank_genes_groups', fontsize=8, ncols=4, sharey=True, show=None, save=None, hover=True, width=None, height=None, **kwds)View on GitHub

Plot gene labels at their stored differential-expression rank and score.

Uses existing results only; neither analysis nor expression extraction runs. Group titles, requested order, score bounds and shared-y behavior follow Scanpy.

Parameters:
  • adata – AnnData with stored rank_genes_groups results.

  • groups – Ranked groups to show, in the requested order.

  • n_genes – Positive number of stored ranks per group.

  • gene_symbols – Annotation column in the ranking’s raw or variable source.

  • key – Stored result key.

  • fontsize – Gene-label font size in points.

  • ncols – Maximum panel columns.

  • sharey – Use common score bounds across panels.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Show gene label, score and zero-based rank.

  • width – Native width per panel, default 300 logical pixels.

  • height – Native height per panel, default 300 logical pixels.

  • **kwds – The n_panels_per_row alias for ncols; other options error.

Returns:

A native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If forwarded options or flags are invalid.

  • ValueError – If stored results, names or score values are invalid.

  • NotImplementedError – If saving requests Matplotlib output.

Example

>>> chart = gsc.pl.rank_genes_groups(pbmc, n_genes=5, show=False)
genome_spy.integrations.scanpy.pl.rank_genes_groups_dotplot(adata, groups=None, *, n_genes=None, groupby=None, values_to_plot=None, var_names=None, gene_symbols=None, min_logfoldchange=None, key=None, show=None, save=None, hover=True, zoom=False, highlight=False, width=None, height=None, **kwds)View on GitHub

Plot stored ranked genes through the existing native dotplot.

Selects top or tail genes with Scanpy’s public getter. Colors show means or stored statistics; sizes always show expressing-cell fractions.

Parameters:
  • adata – AnnData containing stored rankings and expression.

  • groups – Rank lists to select; does not filter expression groups or cells.

  • n_genes – Genes per list, default 10; negative selects the stored tail.

  • groupby – Expression grouping key, default the ranking’s groupby.

  • values_to_plot – Stored statistic for colors, or None for expression means. log10_pvals and log10_pvals_adj use negative base-10 logarithms.

  • var_names – Explicit markers instead of n_genes, retaining repeated slots.

  • gene_symbols – Variable annotation used for gene labels and lookup.

  • min_logfoldchange – Strict lower stored log-fold-change threshold.

  • key – Stored ranking key, default rank_genes_groups.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Enable the parent plot’s native summary tooltips.

  • zoom – True navigates y only; “xy” navigates both axes.

  • highlight – False disables feedback; True shows a ruler; “outline” outlines a hovered dot.

  • width – Parent plot width in logical pixels.

  • height – Parent plot height in logical pixels.

  • **kwds – Existing dotplot options; dendrogram defaults True.

Returns:

A native dotplot when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • ValueError – If stored rankings or gene-selection options are invalid.

  • TypeError – If forwarded options are unsupported.

  • NotImplementedError – If renderer options are unsupported.

Example

>>> chart = gsc.pl.rank_genes_groups_dotplot(pbmc, n_genes=3, show=False)
genome_spy.integrations.scanpy.pl.rank_genes_groups_matrixplot(adata, groups=None, *, n_genes=None, groupby=None, values_to_plot=None, var_names=None, gene_symbols=None, min_logfoldchange=None, key=None, show=None, save=None, hover=True, zoom=False, show_values=False, width=None, height=None, **kwds)View on GitHub

Plot stored ranked genes through the existing native matrixplot.

Reuses ranked marker selection, supplied statistic tables and parent chart helpers. Stored statistics bypass expression scaling, as in Scanpy.

Parameters:
  • adata – AnnData containing stored rankings and expression.

  • groups – Rank lists to select; does not filter expression groups or cells.

  • n_genes – Genes per list, default 10; negative selects the stored tail.

  • groupby – Expression grouping key, default the ranking’s groupby.

  • values_to_plot – Stored statistic for colors, or None for expression means. log10_pvals and log10_pvals_adj use negative base-10 logarithms.

  • var_names – Explicit markers instead of n_genes.

  • gene_symbols – Variable annotation used for gene labels and lookup.

  • min_logfoldchange – Strict lower stored log-fold-change threshold.

  • key – Stored ranking key, default rank_genes_groups.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Enable the parent plot’s native summary tooltips.

  • zoom – True navigates y only; “xy” navigates both axes.

  • show_values – Show fitted plotted values when tiles have room.

  • width – Parent plot width in logical pixels.

  • height – Parent plot height in logical pixels.

  • **kwds – Existing matrixplot options; dendrogram defaults True.

Returns:

A native matrixplot when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • ValueError – If stored rankings or gene-selection options are invalid.

  • TypeError – If forwarded options are unsupported.

  • NotImplementedError – If renderer options are unsupported.

Example

>>> chart = gsc.pl.rank_genes_groups_matrixplot(pbmc, n_genes=3, show=False)
genome_spy.integrations.scanpy.pl.rank_genes_groups_heatmap(adata, groups=None, *, n_genes=None, groupby=None, gene_symbols=None, var_names=None, min_logfoldchange=None, key=None, show=None, save=None, hover=True, zoom=False, show_values=False, group_gap=0, width=None, height=None, **kwds)View on GitHub

Plot stored ranked genes through the existing individual-cell heatmap.

Reuses ranked marker selection and all parent heatmap data and chart helpers.

Parameters:
  • adata – AnnData containing stored rankings and expression.

  • groups – Rank lists to select; does not filter expression groups or cells.

  • n_genes – Genes per list, default 10; negative selects the stored tail.

  • groupby – Expression grouping key, default the ranking’s groupby.

  • gene_symbols – Variable annotation used for gene labels and lookup.

  • var_names – Explicit markers instead of n_genes.

  • min_logfoldchange – Strict lower stored log-fold-change threshold.

  • key – Stored ranking key, default rank_genes_groups.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Enable native cell tooltips.

  • zoom – True navigates y only; “xy” navigates both axes.

  • show_values – Show fitted plotted values when tiles have room.

  • group_gap – Space between groups in CSS pixels; 0 keeps tiles contiguous.

  • width – Parent heatmap width in logical pixels.

  • height – Parent heatmap height in logical pixels.

  • **kwds – Existing heatmap options; dendrogram defaults True.

Returns:

A native heatmap when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • ValueError – If stored rankings or gene-selection options are invalid.

  • TypeError – If forwarded options are unsupported.

  • NotImplementedError – If renderer options are unsupported.

Example

>>> chart = gsc.pl.rank_genes_groups_heatmap(pbmc, n_genes=3, show=False)
genome_spy.integrations.scanpy.pl.umap(adata, *, color=None, mask_obs=None, gene_symbols=None, use_raw=None, sort_order=True, edges=False, edges_width=0.1, edges_color='grey', neighbors_key=None, arrows=False, arrows_kwds=None, groups=None, components=None, dimensions=None, layer=None, projection='2d', scale_factor=None, color_map=None, cmap=None, palette=None, na_color='lightgray', na_in_legend=True, size=None, frameon=None, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, colorbar_loc='right', vmax=None, vmin=None, vcenter=None, norm=None, add_outline=False, outline_width=(0.3, 0.05), outline_color=('black', 'white'), ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, marker='.', hover=True, zoom=False, selection=None, obs_id=None, width=None, height=None, **kwargs)View on GitHub

Plot stored UMAP coordinates through the shared embedding renderer.

Preserves Scanpy defaults and the existing native UMAP controls. Computes no embedding and does not modify AnnData; see pl.embedding for shared options.

Parameters:
  • adata – AnnData containing umap or X_umap coordinates.

  • **kwargs – Shared embedding options shown in the signature, including hover, zoom, selection, obs_id, width and height.

Returns:

A native chart when show=False, otherwise None after display.

Raises:
  • ImportError – If the supported Scanpy dependency is unavailable.

  • TypeError – If arguments or source types are invalid.

  • ValueError – If stored coordinates or requested data are invalid.

  • NotImplementedError – If a renderer option is unsupported.

Example

>>> chart = gsc.pl.umap(adata, color=["cell_type", "MS4A1"], show=False)
genome_spy.integrations.scanpy.pl.embedding(adata, basis, *, color=None, mask_obs=None, gene_symbols=None, use_raw=None, sort_order=True, edges=False, edges_width=0.1, edges_color='grey', neighbors_key=None, arrows=False, arrows_kwds=None, groups=None, components=None, dimensions=None, layer=None, projection='2d', scale_factor=None, color_map=None, cmap=None, palette=None, na_color='lightgray', na_in_legend=True, size=None, frameon=None, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, colorbar_loc='right', vmax=None, vmin=None, vcenter=None, norm=None, add_outline=False, outline_width=(0.3, 0.05), outline_color=('black', 'white'), ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, marker='.', hover=True, zoom=False, selection=None, obs_id=None, width=None, height=None, **kwargs)View on GitHub

Plot supplied 2D embedding coordinates with Scanpy-compatible colors.

Reads an existing obsm basis using direct-name then X_ precedence. Shared options cover categorical/continuous colors, component panels, masks, native sizing, hover, zoom and interval selection. Analysis stays in Scanpy.

Parameters:
  • adata – AnnData containing the supplied coordinates and requested colors.

  • basis – Existing obsm name, such as umap, tsne, diffmap or pca.

  • **kwargs – Shared embedding options shown in the signature. Components are one-based strings; dimensions are zero-based pairs. Raw/layer lookup, colors, defaults and native controls match pl.umap. marker accepts ‘.’, ‘o’, ‘s’ and ‘D’, once or per panel. colorbar_loc accepts right, left, top, bottom, or None to hide it. add_outline draws two background outlines with outline_width and outline_color; the foreground then defaults to alpha=0.7. vmin/vmax/vcenter also accept callables returning a finite number from each panel’s masked colors in painting order, including missing values. vcenter maps to the native color scheme’s midpoint; automatic limits expand when needed to enclose it, while explicit limits must enclose it. edges draws the stored undirected neighbor graph beneath points; edges_width uses points and edges_color requires one opaque CSS color. neighbors_key selects saved metadata. Edges currently require the first two components and a graph without self-loops. selection accepts a native x/y interval parameter and adds a live cell count without changing point appearance. With zoom=True, Shift-drag brushes and ordinary dragging pans.

Returns:

A native chart when show=False, otherwise None after display.

Raises:
  • ImportError – If the pinned optional Scanpy dependency is unavailable.

  • TypeError – If options or source types are invalid.

  • ValueError – If coordinates, colors or component requests are invalid.

  • NotImplementedError – If a renderer option is unsupported.

Example

>>> chart = gsc.pl.embedding(adata, "pca", color="cell_type", show=False)
genome_spy.integrations.scanpy.pl.tsne(adata, *, color=None, mask_obs=None, gene_symbols=None, use_raw=None, sort_order=True, edges=False, edges_width=0.1, edges_color='grey', neighbors_key=None, arrows=False, arrows_kwds=None, groups=None, components=None, dimensions=None, layer=None, projection='2d', scale_factor=None, color_map=None, cmap=None, palette=None, na_color='lightgray', na_in_legend=True, size=None, frameon=None, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, colorbar_loc='right', vmax=None, vmin=None, vcenter=None, norm=None, add_outline=False, outline_width=(0.3, 0.05), outline_color=('black', 'white'), ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, marker='.', hover=True, zoom=False, selection=None, obs_id=None, width=None, height=None, **kwargs)View on GitHub

Plot stored t-SNE coordinates through the shared embedding renderer.

Uses tsne or X_tsne without computing t-SNE; see pl.embedding for options.

Parameters:
  • adata – AnnData containing supplied t-SNE coordinates.

  • **kwargs – Shared embedding colors, component choices and native controls.

Returns:

A native chart when show=False, otherwise None after display.

Raises:
  • ImportError – If the supported Scanpy dependency is unavailable.

  • TypeError – If arguments or source types are invalid.

  • ValueError – If coordinates or requested data are missing or invalid.

  • NotImplementedError – If a renderer option is unsupported.

Example

>>> chart = gsc.pl.tsne(adata, color="cell_type", zoom=True, show=False)
genome_spy.integrations.scanpy.pl.diffmap(adata, *, color=None, mask_obs=None, gene_symbols=None, use_raw=None, sort_order=True, edges=False, edges_width=0.1, edges_color='grey', neighbors_key=None, arrows=False, arrows_kwds=None, groups=None, components=None, dimensions=None, layer=None, projection='2d', scale_factor=None, color_map=None, cmap=None, palette=None, na_color='lightgray', na_in_legend=True, size=None, frameon=None, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, colorbar_loc='right', vmax=None, vmin=None, vcenter=None, norm=None, add_outline=False, outline_width=(0.3, 0.05), outline_color=('black', 'white'), ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, marker='.', hover=True, zoom=False, selection=None, obs_id=None, width=None, height=None, **kwargs)View on GitHub

Plot stored diffusion coordinates through the shared embedding renderer.

Preserves Scanpy 1.11.5’s default first two columns and DC labels. Reads diffmap or X_diffmap without fitting diffusion components or neighbors.

Parameters:
  • adata – AnnData containing supplied diffusion coordinates.

  • **kwargs – Shared embedding colors, component choices and native controls.

Returns:

A native chart when show=False, otherwise None after display.

Raises:
  • ImportError – If the supported Scanpy dependency is unavailable.

  • TypeError – If arguments or source types are invalid.

  • ValueError – If coordinates or requested data are missing or invalid.

  • NotImplementedError – If a renderer option is unsupported.

Example

>>> chart = gsc.pl.diffmap(adata, components="2,3", show=False)
genome_spy.integrations.scanpy.pl.draw_graph(adata, *, color=None, mask_obs=None, gene_symbols=None, use_raw=None, sort_order=True, edges=False, edges_width=0.1, edges_color='grey', neighbors_key=None, arrows=False, arrows_kwds=None, groups=None, components=None, dimensions=None, layer=None, projection='2d', scale_factor=None, color_map=None, cmap=None, palette=None, na_color='lightgray', na_in_legend=True, size=None, frameon=None, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, colorbar_loc='right', vmax=None, vmin=None, vcenter=None, norm=None, add_outline=False, outline_width=(0.3, 0.05), outline_color=('black', 'white'), ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, marker='.', hover=True, zoom=False, selection=None, obs_id=None, width=None, height=None, layout=None, **kwargs)View on GitHub

Plot an existing graph layout through the shared embedding renderer.

Reads the requested X_draw_graph_<layout> coordinates. With layout=None, uses the saved draw_graph params; never computes a layout or neighbors.

Parameters:
  • adata – AnnData containing saved graph-layout coordinates.

  • layout – Saved layout name; None uses the last computed layout.

  • **kwargs – Shared embedding colors, component choices and native controls.

Returns:

A native chart when show=False, otherwise None after display.

Raises:
  • ImportError – If the supported Scanpy dependency is unavailable.

  • TypeError – If arguments or source types are invalid.

  • ValueError – If layout metadata, coordinates or requested data are invalid.

  • NotImplementedError – If a renderer option is unsupported.

Example

>>> chart = gsc.pl.draw_graph(adata, layout="fa", color="cell_type", show=False)
genome_spy.integrations.scanpy.pl.pca(adata, *, color=None, mask_obs=None, gene_symbols=None, use_raw=None, sort_order=True, edges=False, edges_width=0.1, edges_color='grey', neighbors_key=None, arrows=False, arrows_kwds=None, groups=None, components=None, dimensions=None, layer=None, projection='2d', scale_factor=None, color_map=None, cmap=None, palette=None, na_color='lightgray', na_in_legend=True, size=None, frameon=None, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, colorbar_loc='right', vmax=None, vmin=None, vcenter=None, norm=None, add_outline=False, outline_width=(0.3, 0.05), outline_color=('black', 'white'), ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, marker='.', hover=True, zoom=False, selection=None, obs_id=None, width=None, height=None, annotate_var_explained=False, **kwargs)View on GitHub

Plot stored PCA coordinates, optionally labeling their explained variance.

Reuses embedding data, chart and interaction helpers. Variance annotations read uns[‘pca’][‘variance_ratio’]; plotting never fits PCA.

Parameters:
  • adata – AnnData containing pca or X_pca coordinates.

  • annotate_var_explained – Add stored variance percentages to PC axis labels.

  • **kwargs – Shared embedding colors, component choices and native controls.

Returns:

A native chart when show=False, otherwise None after display.

Raises:
  • ImportError – If the supported Scanpy dependency is unavailable.

  • TypeError – If arguments or source types are invalid.

  • ValueError – If coordinates or required variance metadata are invalid.

  • NotImplementedError – If a renderer option is unsupported.

Example

>>> chart = gsc.pl.pca(adata, annotate_var_explained=True, show=False)
genome_spy.integrations.scanpy.pl.pca_scatter(adata, *, color=None, mask_obs=None, gene_symbols=None, use_raw=None, sort_order=True, edges=False, edges_width=0.1, edges_color='grey', neighbors_key=None, arrows=False, arrows_kwds=None, groups=None, components=None, dimensions=None, layer=None, projection='2d', scale_factor=None, color_map=None, cmap=None, palette=None, na_color='lightgray', na_in_legend=True, size=None, frameon=None, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, colorbar_loc='right', vmax=None, vmin=None, vcenter=None, norm=None, add_outline=False, outline_width=(0.3, 0.05), outline_color=('black', 'white'), ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, marker='.', hover=True, zoom=False, selection=None, obs_id=None, width=None, height=None, annotate_var_explained=False, **kwargs)View on GitHub

Plot stored PCA coordinates, optionally labeling their explained variance.

Reuses embedding data, chart and interaction helpers. Variance annotations read uns[‘pca’][‘variance_ratio’]; plotting never fits PCA.

Parameters:
  • adata – AnnData containing pca or X_pca coordinates.

  • annotate_var_explained – Add stored variance percentages to PC axis labels.

  • **kwargs – Shared embedding colors, component choices and native controls.

Returns:

A native chart when show=False, otherwise None after display.

Raises:
  • ImportError – If the supported Scanpy dependency is unavailable.

  • TypeError – If arguments or source types are invalid.

  • ValueError – If coordinates or required variance metadata are invalid.

  • NotImplementedError – If a renderer option is unsupported.

Example

>>> chart = gsc.pl.pca(adata, annotate_var_explained=True, show=False)
genome_spy.integrations.scanpy.pl.pca_loadings(adata, components=None, *, include_lowest=True, n_points=None, show=None, save=None, hover=True, width=None, height=None)View on GitHub

Rank genes by their stored principal-component loadings.

Reads varm[“PCs”] and variable names, using the same rank panels as ranking. Neither PCA nor expression extraction runs, and AnnData stays unchanged. The display adds 30% of the score range above the labels’ loading values.

Parameters:
  • adata – AnnData with resident NumPy loadings in varm[“PCs”].

  • components – One-based components in display order; default first three.

  • include_lowest – Show both loading extremes, with a gap for omitted ranks.

  • n_points – Rank count, default min(30, adata.n_vars). Without include_lowest, Scanpy includes one extra label when available.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Show gene name, loading score and displayed rank.

  • width – Native width per panel, default 300 logical pixels.

  • height – Native height per panel, default 300 logical pixels.

Returns:

A native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If AnnData, flags or loading storage are unsupported.

  • ValueError – If stored loadings, components, counts or dimensions are invalid.

  • NotImplementedError – If saving requests Matplotlib output.

Example

>>> chart = gsc.pl.pca_loadings(adata, components="1,2", show=False)
genome_spy.integrations.scanpy.pl.pca_variance_ratio(adata, n_pcs=30, *, log=False, show=None, save=None, hover=True, width=None, height=None)View on GitHub

Plot ranked variance ratios from stored PCA results.

Reads uns[“pca”][“variance_ratio”] through the shared ranking helpers. log=True takes the natural logarithm before sorting, as Scanpy does; PCA and expression access never run, and stored results stay unchanged. The display adds 30% of the score range above the plotted values for labels.

Parameters:
  • adata – AnnData with a resident variance-ratio vector in uns[“pca”].

  • n_pcs – Positive rank count; Scanpy includes one extra PC when available.

  • log – Take the natural logarithm of positive ratios before ranking.

  • show – Display once, return chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Show the original PC label, plotted score and displayed rank.

  • width – Native plot width, default 300 logical pixels.

  • height – Native plot height, default 300 logical pixels.

Returns:

A native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If AnnData, flags or variance-ratio storage are unsupported.

  • ValueError – If ratios, log inputs, rank counts or dimensions are invalid.

  • NotImplementedError – If saving requests Matplotlib output.

Example

>>> chart = gsc.pl.pca_variance_ratio(adata, n_pcs=10, log=True, show=False)
genome_spy.integrations.scanpy.pl.pca_overview(adata, *, show=None, save=None, **params)View on GitHub

Combine stored PCA coordinates, loadings and variance ratios.

Reuses pca, pca_loadings and pca_variance_ratio in Scanpy’s display order. Cell positions sit above two diagnostic rows: PC1/PC2, then PC3/variance. Plotting never computes PCA, filters genes or modifies supplied results.

Parameters:
  • adata – AnnData containing the stored results required by all three plots.

  • show – Display once, return the chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • **params – Supported pca options, including color, components, hover, zoom, width and height. These affect only the embedding section. Loadings use 280-pixel panels in two columns; other diagnostic defaults remain.

Returns:

A vertically composed native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy dependency is unavailable.

  • TypeError – If options or stored result types are unsupported.

  • ValueError – If required results, selected values or dimensions are invalid.

  • NotImplementedError – If a parent plot’s rendering option is unsupported.

Example

>>> chart = gsc.pl.pca_overview(adata, color="cell_type", show=False)
genome_spy.integrations.scanpy.pl.scatter(adata, x=None, y=None, *, color=None, use_raw=None, layers=None, sort_order=True, alpha=None, basis=None, groups=None, components=None, projection='2d', legend_loc='right margin', legend_fontsize=None, legend_fontweight=None, legend_fontoutline=None, color_map=None, palette=None, frameon=None, right_margin=None, left_margin=None, size=None, marker='.', title=None, show=None, save=None, hover=True, zoom=False, width=None, height=None)View on GitHub

Plot cells or genes from supplied coordinates with Scanpy scatter semantics.

Uses observation/variable annotations or selected expression vectors for x and y, or an existing X_<basis> embedding. Reuses native embedding points, colors, guides, hover and zoom without changing AnnData or running analysis.

Parameters:
  • adata – AnnData containing the requested annotations and expression.

  • x – Numeric annotation or expression key for the horizontal axis.

  • y – Numeric annotation or expression key for the vertical axis.

  • color – Annotation/expression key, CSS color, or one per panel.

  • use_raw – Use raw expression; defaults to whether raw exists.

  • layers – One layer for all values, or separate x/y/color layers. Use None or “X” for X; other layers require use_raw=False when raw exists.

  • sort_order – Retained Scanpy flag; pinned scatter always sorts numeric colors.

  • alpha – Scalar point opacity.

  • basis – Existing X_<basis> coordinates, taking priority over x/y.

  • groups – Category names to color; other points remain light gray.

  • components – One-based coordinate pair; diffusion maps skip the first column.

  • projection – Only 2d is currently supported.

  • legend_loc – Right margin or none; other placements currently error.

  • legend_fontsize – Native category legend font size.

  • legend_fontweight – Retained Scanpy option; only affects on-data labels upstream.

  • legend_fontoutline – Nondefault values currently error.

  • color_map – GenomeSpy continuous color scheme name.

  • palette – CSS category colors or native scheme, optionally one per panel.

  • frameon – Embedding frame visibility; x/y plots retain axes as in Scanpy.

  • right_margin – Nondefault values currently error; native guides own layout.

  • left_margin – Nondefault values currently error; use width/height for sizing.

  • size – Scalar point area, defaulting to 120000 divided by the point count.

  • marker – Dot or circle, optionally one per color panel.

  • title – Panel titles, defaulting to annotation names with underscores replaced.

  • show – Display the chart, using Scanpy autoshow when None.

  • save – None/False only; save the returned native chart as HTML/JSON.

  • hover – Enable native point tooltips.

  • zoom – Enable x/y zoom and panning.

  • width – Native panel width in pixels.

  • height – Native panel height in pixels.

Returns:

A native chart when show=False, otherwise None after display.

Raises:
  • ImportError – If the pinned optional Scanpy dependency is unavailable.

  • TypeError – If argument types are invalid or omitted renderer options are passed.

  • ValueError – If data, layers, orientations or components are invalid.

  • NotImplementedError – If an appearance or storage form is unsupported.

Example

>>> chart = gsc.pl.scatter(adata, "n_counts", "n_genes", color="louvain", show=False)
genome_spy.integrations.scanpy.pl.highly_variable_genes(adata_or_result, *, log=False, show=None, save=None, highly_variable_genes=True, hover=True, zoom=False, threshold_slider=False, width=None, height=None)View on GitHub

Plot stored gene means against normalized and raw dispersion or variance.

Reads AnnData.var or supplied results without selecting genes or accessing expression. The two panels share native colors and keep their own axis limits.

Parameters:
  • adata_or_result – AnnData with stored hvg flavor, a DataFrame or record array.

  • log – Use logarithmic axes, retaining Scanpy’s raw-statistic limits.

  • show – Display once, return a chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • highly_variable_genes – Use highly_variable; False reads legacy gene_subset.

  • hover – Show gene identity and the stored plotted statistics.

  • zoom – Enable native x/y zoom independently in each panel.

  • threshold_slider – Add a normalized-score cutoff preview; leaves saved selection unchanged.

  • width – Plot width per panel, default 300 logical pixels.

  • height – Plot height per panel, default 300 logical pixels.

Returns:

A native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If result storage, flags or selected-gene values are invalid.

  • ValueError – If stored fields or dimensions are missing or invalid.

  • NotImplementedError – If log bounds or saving need unsupported behavior.

Example

>>> chart = gsc.pl.highly_variable_genes(adata, zoom=True, show=False)
genome_spy.integrations.scanpy.pl.filter_genes_dispersion(result, *, log=False, show=None, save=None, hover=True, zoom=False, threshold_slider=False, width=None, height=None)View on GitHub

Plot legacy stored dispersions through highly_variable_genes.

Reads gene_subset instead of highly_variable. As with other native plots, show=False returns a chart rather than the legacy wrapper’s None.

Parameters:
  • result – Stored record array with means, dispersions and gene_subset.

  • log – Use logarithmic axes with Scanpy’s stored-statistic limits.

  • show – Display once, return a chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Show gene identity and stored statistics.

  • zoom – Enable native x/y zoom independently in each panel.

  • threshold_slider – Preview a normalized-score cutoff without changing gene_subset.

  • width – Plot width per panel, default 300 logical pixels.

  • height – Plot height per panel, default 300 logical pixels.

Returns:

A native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If result storage or flags are invalid.

  • ValueError – If stored fields or dimensions are missing or invalid.

  • NotImplementedError – If log bounds or saving need unsupported behavior.

Example

>>> chart = gsc.pl.filter_genes_dispersion(result, show=False)
genome_spy.integrations.scanpy.pl.highest_expr_genes(adata, n_top=30, *, layer=None, gene_symbols=None, log=False, show=None, save=None, hover=True, zoom=False, width=None, height=None, **kwds)View on GitHub

Plot per-cell count percentages for genes with the highest mean percentage.

Reuses Scanpy’s public total normalization on X or a layer, ignoring raw. Native boxes show quartiles, 1.5-IQR whiskers and individual outliers. Expression and metadata are never changed, including for AnnData views.

Parameters:
  • adata – AnnData with resident, finite, nonnegative counts.

  • n_top – Number of genes ranked by mean percentage, default 30.

  • layer – Count layer instead of X; raw is never selected implicitly.

  • gene_symbols – Optional var column for unique, nonmissing display labels.

  • log – Use a logarithmic percentage axis; summaries remain in linear units.

  • show – Display once, return a chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Show box summaries and outlier cell identities.

  • zoom – Enable native zoom along the percentage axis.

  • width – Plot width, default 387.5 logical pixels.

  • height – Plot height, default Scanpy’s gene-count-dependent panel height.

  • **kwds – Seaborn styling and Matplotlib options are currently unsupported.

Returns:

A native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If arguments or expression storage are unsupported.

  • ValueError – If counts, labels, dimensions or n_top are invalid.

  • NotImplementedError – If labels are ambiguous or styling/saving is unsupported.

Example

>>> chart = gsc.pl.highest_expr_genes(counts, n_top=20, show=False)
genome_spy.integrations.scanpy.pl.scrublet_score_distribution(adata, *, scale_hist_obs='log', scale_hist_sim='linear', figsize=(8, 3), show=True, save=None, hover=True, zoom=False, threshold_slider=False, width=None, height=None, **kwargs)View on GitHub

Plot stored observed and simulated Scrublet score densities by batch.

Reads obs.doublet_score and uns.scrublet without running Scrublet or reading expression. Each pair retains Scanpy’s fixed bins and stored threshold.

Parameters:
  • adata – AnnData with previously computed Scrublet results.

  • scale_hist_obs – Observed density scale, linear or log (default).

  • scale_hist_sim – Simulated density scale, linear (default) or log.

  • figsize – Approximate figure size per batch in inches, default (8, 3).

  • show – Display once by default; False returns a native chart.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Show each populated bin’s boundaries, count and density.

  • zoom – Enable independent score-axis zoom in each panel.

  • threshold_slider – Preview a cutoff per batch and highlight bins above it. Bins containing the cutoff stay neutral; saved doublet calls are unchanged.

  • width – Plot width per panel, default 340 logical pixels.

  • height – Plot height per panel, default 210 logical pixels.

  • **kwargs – Matplotlib ax/return_fig and other options are omitted.

Returns:

A native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If arguments or score storage are invalid.

  • ValueError – If results, scores, thresholds or dimensions are invalid.

  • NotImplementedError – If scales, unused batch categories or saving are unsupported.

Example

>>> sc.pp.scrublet(counts, threshold=0.25, random_state=0)
>>> chart = gsc.pl.scrublet_score_distribution(counts, show=False)
genome_spy.integrations.scanpy.pl.embedding_density(adata, basis='umap', *, key=None, groupby=None, group='all', color_map='YlOrRd', bg_dotsize=80, fg_dotsize=180, vmax=1, vmin=0, vcenter=None, norm=None, ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, hover=True, zoom=False, obs_id=None, width=None, height=None, **kwargs)View on GitHub

Plot stored embedding densities using the shared native point renderer.

Reads density values and their stored component/covariate metadata. Group panels preserve background cells, sizes and under/over colors without KDE, temporary observation columns or changes to the supplied coordinates.

Parameters:
  • adata – AnnData containing explicitly computed embedding-density results.

  • basis – Stored X_ embedding; lowercase names and the fa alias match Scanpy.

  • key – Stored obs density key with a matching uns key_params mapping.

  • groupby – Append this suffix to the pinned default umap_density key.

  • group – All stored categories by default; select a string/list, or None for ungrouped results.

  • color_map – GenomeSpy continuous scheme, default YlOrRd.

  • bg_dotsize – Background point area in squared points, default 80.

  • fg_dotsize – Foreground point area in squared points, default 180.

  • vmax – Upper color bound, default 1; accepts shared bound forms.

  • vmin – Lower color bound, default 0; accepts shared bound forms.

  • vcenter – Optional numeric, percentile or callable color center.

  • norm – Only None; Matplotlib normalization objects are unsupported.

  • ncols – Maximum panels per row, default 4.

  • hspace – Vertical spacing relative to panel height, default 0.25.

  • wspace – Horizontal spacing relative to width; native default 0.2.

  • title – Optional common panel title; otherwise the selected group.

  • show – Display once, return a chart when False, or use Scanpy autoshow.

  • save – None or False; use native chart.save for HTML/JSON.

  • hover – Show stable cell identity, stored density and coordinates.

  • zoom – Enable shared x/y zoom across density panels.

  • obs_id – Optional unique, nonmissing obs column for stable cell IDs.

  • width – Plot width per panel, default 300 logical pixels.

  • height – Plot height per panel, default 300 logical pixels.

  • **kwargs – Supported embedding styles: frameon, sort_order, marker, alpha, edgecolor/edgecolors, linewidth/linewidths and colorbar_loc. Unsorted points must stay within one color range; native under/over layers otherwise change their overlap order. One marker serves all groups.

Returns:

A native chart when show=False, otherwise None.

Raises:
  • ImportError – If the supported Scanpy version is unavailable.

  • TypeError – If arguments or stored data are invalid.

  • ValueError – If density values, params, groups or dimensions are invalid.

  • NotImplementedError – If options require unsupported normalization or rendering.

Example

>>> sc.tl.embedding_density(adata, basis="umap", groupby="phase")
>>> chart = gsc.pl.embedding_density(adata, groupby="phase", show=False)

Selected cells

genome_spy.integrations.scanpy.selection_mask(adata, snapshot, *, dimensions=(0, 1), basis='umap')View on GitHub

Match an embedding brush to observations in their current row order.

Description:

Uses the same direct-name/X_ precedence as pl.embedding and tests lower-inclusive, upper-exclusive domain bounds. No active rectangle selects zero observations. Only embedding coordinates are read; no expression data is loaded and AnnData is not modified. Keep the plotted coordinates unchanged until retrieving IDs. Row reordering and slicing preserve membership when those coordinates are retained.

Parameters:
  • adata – AnnData containing the coordinates used for the plotted UMAP.

  • snapshot – Interval value from widget.parameter_values, or None before the widget has synchronized.

  • dimensions – Zero-based component pair used in the plotted panels.

  • basis – Embedding name used by the plotted panels; defaults to UMAP.

Returns:

Boolean mask suitable for adata[mask]. Coincident observations remain distinct rows.

Raises:
  • TypeError – If adata or the snapshot has an invalid type.

  • ValueError – If coordinates, dimensions, or interval bounds are invalid.

Example

>>> mask = gsc.selection_mask(adata, view.parameter_values.get("cells"))
>>> selected = adata[mask].copy()