p=DotPlot(norecur,features = c("gene1","gene2","gene3"))
data.usage <-p[["data"]]
data.anno <- data.frame(features.plot=unique(p[["data"]][["features.plot"]]),label=unique(p[["data"]][["features.plot"]]))
df.plot <- plyr::join(data.usage,data.anno)
df.plot$id <- factor(df.plot$id,levels = sort(levels(df.plot$id),decreasing = T) )
ggplot(df.plot,aes(x=features.plot,y =  id,size = pct.exp, color = avg.exp.scaled))+geom_point()+theme(axis.text.x = element_text(angle = 45,hjust = 1)) +labs(title = "pic1")

画出来的图的纵坐标是按照字母顺序排序的,也可以设置想要的顺序

参考Seurat::DotPlot绘图美化-facet方法添加X轴注释标签 - 简书 (jianshu.com)

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐