satijalab / seurat

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

set dotplot y-axis in order #6229

Closed yamihn closed 2 years ago

yamihn commented 2 years ago

Hi, I produced a dotplot with the function DotPlot(obj, features =unique(top2_markers$gene), cols = c("white", "blue"), group.by = "res.0.2", col.min = -0.5) + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + coord_flip() and I got this markers_02

but I would to order the y-axis ( genes) in the way to visualize the dots in order in a diagonal line from bottom left to top right. Could u suggest me a way to do it?

k3yavi commented 2 years ago

Hi @yamihn ,

you can try giving factor instead of a regular vector of gene names to the features parameters, where levels would of the factor would be the the order of the genes you cant in the DotPlot.