scverse / scverse/scanpy

Refactor `BasePlot` not to create a dataframe representation of the data

Open
#3,718 3 comments 0 reactions 1 assignee View on GitHub

@dorzhey is already working on this.

Since Jul 29, 2025.

Area - Plotting 🌺 Area – Performance 🐌 good first issue
Dominant language
Python
Stars
2.6k
Forks
779
Avg merge
1d 4h
Merged PRs (30d)
27

Description

What kind of feature would you like to request?

Additional function parameters / changed functionality / changed defaults?

Please describe your wishes

See #3717 for what prompted me to look at this code.

Currently BasePlot creates a in-memory copy as a dataframe of the main data of interest (obsm, X, layers etc.): https://github.com/scverse/scanpy/blob/0b82c934edeb640095df14e60725ed1fad6eebb1/src/scanpy/plotting/_baseplot_class.py#L148-L157

I believe this to be unnecessary as this dataframe is only ever used for groupby operations, for which we have a zero-copy solution in https://scanpy.readthedocs.io/en/latest/generated/scanpy.get.aggregate.html

Thus we should

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.