scverse / scverse/scanpy

add restrict_to to sc.pl.umap function?

Open
#759 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello,

In some cases, I need to visualize clustering results (categorical) on UMAP for each batch.

I know sc.pl.umap(adata[adata.obs['batch] == 'batch1], color = 'louvain') is a solution. However, other cells are missing. I think the other cells colored by grey as background should be a better way.

I notice that sc.pl.umap(adata, color = 'batch', groups = ['batch1'] ) can retain other cells as grey, though sometimes cells were submerged in the bottom layer (I used reoder_categories to bypass this issue). But, color and groups must be correspondence!

Is there any way to fulfill my needs in Scanpy if I missed something.
Or, could the authors add a parameters, such as restrict_to in sc.tl.louvain, to implement this function: ① liberate strong associations between color and groups, and ② add support for ordering categorical variable

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 sc.pl.umap entry point and its handling of color, groups, categorical ordering, and background cells. Clarify whether the desired behavior is an independent restriction parameter, categorical ordering support, or both; done should be a documented API behavior with coverage for the requested batch visualization.

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.