scverse / scverse/scanpy

Common plotting library for the Scanpy ecosystem

Open
#1,832 3 comments 2 reactions 0 assignees View on GitHub

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:
  • All the scanpy helper functions for plotting (e.g. savefig_or_show, _set_color_for_categorical_obs etc.) 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. scvelo has 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.stackedbarplot by @zktuong, sc_toolbox.api.plot.cluster_composition_stacked_barplot by @Zethson, and scirpy.pl.group_abundance by myself). Maybe such more general plots based on AnnData could be part of a central library as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.