You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Public function for accessing category colors #1881
I noticed that the order of .uns['leiden_colors'] might have changed.
Previously I had a set of codes to extract color codes from that attribute and save into a dictionary.
May I ask what's the proper way to extract color codes in the current version of Scanpy?
Activity
brianpenghe commentedon Jun 17, 2021
Anyway I wrote a function to do that:
https://github.com/brianpenghe/python-genomics/blob/85b546298a6f6b560d1ea6d51143fe5f36e5c01b/Scanpyplus.py#L36
ivirshup commentedon Jun 18, 2021
We'd like to add this to
scanpysomewhere, probably in thesc.getmodule. Maybesc.get.color_palette(adata, obs_key)?Ideally, we eventually just store the colors this way, but this will give developers a stable way to get this information before that happens.
Related discussions: #596, #1392, (and some more I can't seem to find)
ivirshup commentedon Jun 18, 2021
The additional cases that would need to be handled (and what I believe the current internal solutions are):
Most of the logic for handling this internally is wrapped in
_get_palette: https://github.com/theislab/scanpy/blob/ed364a887db2eb604d0a09cd72325cb5e1f4e27e/scanpy/plotting/_tools/scatterplots.py#L1192-L1204[-]Extract color codes from adata object[/-][+]Public function for accessing category colors[/+]