sc.pl.rank_genes_groups() was desgined to display all the groups(such as all the clusters). When plot only a subset of the groups using the ‘groups’ parameter, the color bar would not change according to the subset groups, the orders are confused. here is the warning:
WARNING: Groups are not reordered because the
groupby categories and the
var_group_labels are different.
Then how to disply only a subset of the groups and keep the colorbar the same as that used by ‘louvain’ or ‘leiden’ clusters?