supigen
supigen

Reputation: 17

Adjust the cluster order of sc.pl.heatmap in scanpy

I am a beginner who is studying bioinformatics with scanpy these days.

In the 'sc.pl.heatmap', I want to show ‘leiden’ in a specific order in heatmap, but I don’t know what to do.

I want to show ‘leiden’ in ascending order.

Is there any related function?

Upvotes: 1

Views: 972

Answers (1)

nobot
nobot

Reputation: 93

Assuming you have leiden column in the obs dataframe, you can reorder it as:

adata.obs['leiden'] = adata.obs['leiden'].cat.reorder_categories(['new first', 'new second', ...etc])

Upvotes: 1

Related Questions