scverse / scverse/scanpy

Order of plotting datapoints with categorical colouring should be amended

Open
#1,263 10 comments 1 reaction 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

  • Additional function parameters / changed functionality / changed defaults?

At the moment when we are plotting data points in e.g., sc.pl.umap() with color='covariate' we determine the plotting order in two ways:

  1. if 'covariate' is continuous the highest values are plotted on top, to showcase the peaks of the distribution;
  2. if 'covariate' is a categorical variable, the order of adata.obs_names is used (i believe). As we often concatenate datasets after integration or loading from multiple sources, covariates we plot are usually not randomly ordered here.

I think the first case is fine (and it can be turned off), but we should probably not be doing case 2. Instead, it would be good if the default was to plot in a random order unless the covariate is ordered internally (I believe this is already taken into account, but not sure). I have come across this issue several times now, and we're not solving this in a good way imo. Fabian has mentioned this to me several times as well. What do you think @fidelram @ivirshup ?

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 at the sc.pl.umap() entry point and trace how categorical and continuous color values determine plotting order. Compare the existing handling of ordered categorical variables with the requested default behavior, then verify that the resulting ordering is reflected in the relevant plotting tests; done means categorical points no longer follow concatenated obs_names by default.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.