Skip to content

Order of plotting datapoints with categorical colouring should be amended #1263

@LuckyMD

Description

@LuckyMD
  • 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 ?

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions