why cannot set the specific color?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
...
colors_use = ['red', 'blue', 'green', 'purple', 'yellow', 'brown', 'black', 'peru', 'orange', 'olive',
'darksage', 'cyan', 'lime', 'pink', 'teal', 'violet', 'darkblue', 'magenta', 'coral', 'gray']
adata = sc.AnnData(embedding)
adata.obs["category"] = label.astype(np.int)
adata.obs["domain"] = batch.astype(np.int)
sc.tl.tsne(adata, use_rep = 'X', n_jobs = 10)
adata.uns["category_colors"] = list(colors_use[:len(np.unique(label))])
adata.uns["domain_colors"] = list(colors_use[:len(np.unique(batch))])
sc.pl.tsne(adata, color = ["category", "domain"], title = ["class", "domain"],
show = False, size = 50000 / len(label), save = "/{}.pdf".format(file))
My scanpy version is 1.4.6, but when I run the above codes, I find that the color is continuous, why cannot set my specific color?
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 by reproducing the provided Python example with Scanpy 1.4.6 and inspect the sc.pl.tsne color handling for category_colors and domain_colors. Done means determining why the categorical observations are rendered with a continuous color scale and confirming the expected specific colors are used.
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
- 25/100