satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.25k stars 904 forks source link

Dotplot changes order with every new gene added #6829

Closed seigfried closed 1 year ago

seigfried commented 1 year ago

Hello, Is there a way to keep the dotplot clustering order/ dendrogram fixed using the 2000 highly variable genes found using FindVariableFeatures and display only the genes currently stored in features

Right now it changes the clustering order each time I change the features which is the default behaviour

Many thanks

It would be convenient to keep this order for the dotplot

longmanz commented 1 year ago

Hi, To fix the order of clusters in a figure, you can try to generate a new factor variable in your meta-data (e.g., seurat.obj$group_info = factor(seurat.obj$cluster, levels = c('cluster1', 'cluster2', ...)). In such way, when you run DotPlot(..., group.by = 'group_info' ), the cluster should follow the exact order you have specified.