scverse / scverse/scanpy

Allow using arbitrary vectors in plotting (not only `obs` columns)

Open
#1,500 4 comments 0 reactions 1 assignee View on GitHub

@flying-sheep is already working on this.

Since Oct 30, 2025.

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

Description

  • Additional function parameters / changed functionality / changed defaults?
  • New analysis tool: A simple analysis tool you have been using and are missing in sc.tools?
  • New plotting function: A kind of plot you would like to seein sc.pl?
  • External tools: Do you know an existing package that should go into sc.external.*?
  • Other?

Quite often I need to color UMAPs based on features that are not part of adata.X but adata.obsm for the reason that they are special. E.g. KO data with gRNAs versus endogenes/ target genes, or viral genes versus edogenes.

Example use case:

  • Cluster cells based on endogenes
  • UMAP and color by a bunch of viral genes

Clustering must not include these viral genes -> must be excluded from X.
I don't want to store so many additional columns in obs and I need to have these features separated in their own matrix for downstream analysis, which is why I want to use obsm.

Can we have sth. like this:

sc.pl.umap(adata, color='viral_genes')  # adata.obsm['viral_genes'] is a pandas.DataFrame ?

It shouldn't be overcomplicated I think, since this only involves an additional check: if the elements in the color arg list are not found in obs.columns nor var.columns, then check the keys in obsm and use the entire dataframe behind this key.

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.