Common plotting library for the Scanpy ecosystem
Open
Nobody has claimed this yet.
Question
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
I was wondering if plotting could be facilitated and made more consistent across
the Scanpy ecosystem. I envisage a library ("scanpyplot" or whatever) that
- provides building blocks for single-cell-related plots which can be re-used across the ecosystem
- provides helper functions for handling colors, saving figures, etc.
- encourages a consistent plotting API (e.g. by defining abstract base classes)
Motivation:
- Even within scanpy, there is quite some duplicated code in the plotting section. Reducing duplicated code reduces the maintenance burden in the long run. Across the ecosystem there's even more duplicated plotting code:
- While implementing the
scirpy.pl.clonotype_networkfunction, I found myself copying over a lot of code from thescanpy.pl.pagaandscanpy.pl.dotplotfunctions. - scvelo also copied most of the paga code
- scvelo has its own
scatter
- While implementing the
- All the scanpy helper functions for plotting (e.g.
savefig_or_show,_set_color_for_categorical_obsetc.) are private scanpy functions. Implementing plotting functions with consistent bahaviour requires either to duplicate a lot of code, or to rely on a potentially unstable API. In fact, e.g.scvelohas duplicates of most of these scanpy helper functions. Squidpy has similar functions, too. - I know at least three ecosystem libraries that implement some variant of a stacked barplot based on
AnnData.obs(dandelion.pl.stackedbarplotby @zktuong,sc_toolbox.api.plot.cluster_composition_stacked_barplotby @Zethson, andscirpy.pl.group_abundanceby myself). Maybe such more general plots based onAnnDatacould be part of a central library as well.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the plotting section around scanpy.pl.paga and scanpy.pl.dotplot, along with the referenced helpers savefig_or_show and _set_color_for_categorical_obs. Compare the duplicated plotting utilities described for scvelo, Squidpy, and other ecosystem libraries, then clarify the library’s scope and API before implementation; the issue does not define a concrete completion test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100