scverse / scanpy

Single-cell analysis in Python. Scales to >1M cells.
https://scanpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.9k stars 597 forks source link

categories_order of sc.pl.tracksplot does not work #2250

Open wubaosheng opened 2 years ago

wubaosheng commented 2 years ago

Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Minimal code sample (that we can copy&paste without having any data)

categories_order=['0','1','9','8','2','5','4','7','3','6']
sc.pl.tracksplot(adata,markers,groupby='leiden',vmax=3,categories_order=categories_order)
[Paste the error output produced by the above code here]

image I can not get the order as ['0','1','9','8','2','5','4','7','3','6']

Versions

1.9.1

[Paste the output of scanpy.logging.print_versions() leaving a blank line after the details tag]
Zethson commented 2 years ago

Could you please provide a minimal working example? As stated: Minimal code sample (that we can copy&paste without having any data)

This would help us examine the issue.

wubaosheng commented 2 years ago
adata = sc.datasets.pbmc68k_reduced()
markers = ['C1QA', 'PSAP', 'CD79A', 'CD79B', 'CST3', 'LYZ']
categories_order=['0','1','9','8','2','5','4','7','3','6','10']
sc.pl.tracksplot(adata,markers,groupby='louvain',vmax=3,categories_order=categories_order)

no mattet what the "categories_order" is, there is no work on the order of the label.Even the categories_order is error, such as categories_order = ['a','b','c','d'], the figure can not do anything on the order of the labels

wubaosheng commented 2 years ago

image

sunflower769 commented 1 month ago

I also have this issue. In the documentation it also doesn't state what the input format should by, I tried as a list (similar to order in violin plot) but I get no change...

flying-sheep commented 1 month ago

I don’t think it’s currently supported for heatmap and tracksplot.

Have you tried using col.cat.reorder_categories(...) on the column?