pl.embedding sets uns.<field>_colors when palette=None
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of scanpy.
- (optional) I have confirmed this bug exists on the master branch of scanpy.
From pl.embedding documentation, for palette, it states
If provided, values of adata.uns["{var}_colors"] will be set.
This implies that if not provided, then those values will not be set.
However, they are being set - either without specifying palette (default:None), or explicitly passing palette=None
Either it's a bug, or the documentation is not clear.
Minimal code sample (that we can copy&paste without having any data)
adata = sc.read_h5ad('my_matrix.h5ad')
adata.uns = {} #confirming *_colors is not set already
sc.pl.embedding(adata, basis='X_umap', palette=None, color=['cell_type'])
adata.uns['cell_type_colors']
['#1f77b4',
'#ff7f0e',
'#279e68',
'#d62728',
'#aa40fc',
'#8c564b',
'#e377c2',
'#b5bd61',
'#17becf']
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 with the scanpy.pl.embedding entry point and the linked palette documentation, then reproduce the minimal example with palette omitted and with palette=None. Trace where adata.uns["cell_type_colors"] is set and determine whether the behavior or the documentation should change; done means the implementation and documented palette semantics agree.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100