1

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?

supigen
  • 17
  • 4

1 Answers1

1

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])
nobot
  • 63
  • 1
  • 7