dittoDotPlot from the dittoSeq package. Much easier than from scratch. The resulting plot is still a ggplot2 object, so you can customize as you'd like. Though the function itself is also quite flexible. Works natively on SingleCellExperiment, Seurat, or SummarizedExperiment objects and can use gene expression and/or continuous metadata variables as desired.
So all you'd have to do is grab your top 5 markers for each cluster or what have you and feed them in along with your data object:
your_markers <- c("Gfap", "Vim", "Aqp4") dittoDotPlot(sce_seurat_or_se_object, your_markers, group.by = "cluster_metadata_column") + coord_flip()
From scratch, this is just a start, depends how far you want to go to have the same exact plot:
library(ggplot2) # ggplot2_3.3.3 # example data d <- mtcars[1:10, ] d$car <- rownames(d) d$carb <- as.factor(d$carb) d$cyl <- as.factor(d$cyl) # plot ggplot(d, aes(car, carb, size = qsec, fill = cyl)) + geom_point(shape = 21) + theme_light() + guides(x = guide_axis(angle = 90))
But, I'd first find that paper where this plot is coming from, then check if they have anything at GitHub.