Skip to content

docs(plotting): add inline example plots for 4 sc.pl functions (#1664)#4103

Merged
flying-sheep merged 1 commit into
scverse:mainfrom
Hore01:docs/issue-1664-inline-example-plots
May 8, 2026
Merged

docs(plotting): add inline example plots for 4 sc.pl functions (#1664)#4103
flying-sheep merged 1 commit into
scverse:mainfrom
Hore01:docs/issue-1664-inline-example-plots

Conversation

@Hore01
Copy link
Copy Markdown
Contributor

@Hore01 Hore01 commented May 6, 2026

Summary

Adds inline example plots to four sc.pl.* functions still unchecked on the issue #1664 checklist:

  • sc.pl.embedding — top of the list; the generic embedding plotter
  • sc.pl.scatter — daily-driver basic scatter (currently in "Misc")
  • sc.pl.ranking — small example showing the pl.pca_loadings-style usage
  • sc.pl.paga_compare — closes a gap in the PAGA section

Each new Examples section uses one or more .. plot:: :context: close-figs blocks and the bundled sc.datasets.pbmc68k_reduced() dataset, no network downloads, deterministic across CI runs. The matplotlib plot_directive is already wired up in docs/conf.py, so no Sphinx config changes were needed.

For sc.pl.ranking, the example subsets to adata[:, adata.var["highly_variable"]] because pbmc68k_reduced carries PCA loadings only for the highly-variable subset (the rest are NaN); without subsetting, argsort pulls the NaNs to
the top and set_ylim raises. Subsetting in the example also reads as a useful hint for users.

I confirmed none of these functions overlap with @Ekin-Kahraman's recently-merged PRs (#4056-#4059).

Refs #1664.

Why this issue

scanpy's plotting API is the daily workhorse for single-cell exploratory analysis. Embedding example plots directly under each function's docstring closes the loop between API reference and visual output, exactly the "honest reporting + high-impact dashboard" principle I bring to data work.

Test plan

  • Read the Docs build succeeds and the four function pages now show rendered example plots in their Examples section
  • No regression in the existing inline-plot pages (sc.pl.dotplot,sc.pl.umap, etc.)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.61%. Comparing base (ba83d77) to head (5de6ffa).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4103   +/-   ##
=======================================
  Coverage   79.61%   79.61%           
=======================================
  Files         120      120           
  Lines       12941    12941           
=======================================
  Hits        10303    10303           
  Misses       2638     2638           
Flag Coverage Δ
hatch-test.low-vers 78.92% <ø> (+0.02%) ⬆️
hatch-test.pre 79.49% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/scanpy/plotting/_anndata.py 85.42% <ø> (ø)
src/scanpy/plotting/_tools/paga.py 64.26% <ø> (ø)
src/scanpy/plotting/_tools/scatterplots.py 83.41% <ø> (ø)

... and 1 file with indirect coverage changes

…ing, paga_compare (scverse#1664)

Adds Examples sections with `.. plot::` directives to four public plotting
functions that lacked rendered examples in the API reference:

- sc.pl.embedding: UMAP coloured by cell-type, plus a multi-panel example
- sc.pl.scatter:   obs-vs-obs, gene-vs-gene, and basis-driven panels
- sc.pl.ranking:   top-3 PC loadings, with and without the lowest values
- sc.pl.paga_compare: PAGA graph next to the UMAP embedding

All examples use the bundled sc.datasets.pbmc68k_reduced() so the docs
build stays self-contained and deterministic.

Refs scverse#1664.
@Hore01 Hore01 force-pushed the docs/issue-1664-inline-example-plots branch from bc92bca to 5de6ffa Compare May 6, 2026 17:53
@flying-sheep flying-sheep added this to the 1.12.2 milestone May 8, 2026
@flying-sheep
Copy link
Copy Markdown
Member

Wonderful, thank you so much!

@flying-sheep flying-sheep merged commit 6af627e into scverse:main May 8, 2026
19 of 20 checks passed
@flying-sheep flying-sheep mentioned this pull request May 8, 2026
56 tasks
flying-sheep pushed a commit that referenced this pull request May 8, 2026
…e plots for 4 sc.pl functions (#1664)) (#4111)

Co-authored-by: Olajumoke Akinremi <106763970+Hore01@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants