Starlitnightly / omicverse

A python library for multi omics included bulk, single cell and spatial RNA-seq analysis.
https://starlitnightly.github.io/omicverse/
GNU General Public License v3.0
277 stars 32 forks source link

defined order for the plot of groups #41

Closed xflicsu closed 2 months ago

xflicsu commented 6 months ago

We may need to the defined order of groups, when we plot with 'plot_cellproportion' in OV. So, could you provide a parameter for the order of groups?

Starlitnightly commented 6 months ago

Hi,

Thank you for your suggestion. You can use the following code to adjust the order of groups using adata.obs['major_celltype'].cat.reorder_categories:

adata.obs['major_celltype'] = adata.obs['major_celltype'].cat.reorder_categories(['B cells', 'T cells', 'Plasma',
                                                                                   'Macro', 'Mono', 'Mast', 'DC',
                                                                                   'Principal cell', 'Podocyte',
                                                                                   'Proximal tubular cell',
                                                                                   'Distal tubular cell',
                                                                                   'Loop of Henle cell',
                                                                                   'Intercalated cell', 'Fibro', 'Tumor/TECs'])

Feel free to let me know if you have any more questions!

Zehua