Order of plotting datapoints with categorical colouring should be amended
Nobody has claimed this yet.
- 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:
- if
'covariate'is continuous the highest values are plotted on top, to showcase the peaks of the distribution; - if
'covariate'is a categorical variable, the order ofadata.obs_namesis 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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