左边是默认,右边是自定义颜色后。
# named color
color.head=c('#617381', "#76AB9B", '#CE5A5B', "#EA7C5B");
names(color.head) =c("NL", "LP", "CA", "LN")
color.head
# draw with Seurat
g1=DotPlot(scObj, features = c("CD300LF"), group.by = "tissue.type",
cluster.idents = F)+labs(x="", y="") + NoLegend(); g1 #+ #+RotatedAxis() #+ coord_flip()
# >> get data from ggplot obj
head(g1$data)
# avg.exp pct.exp features.plot id avg.exp.scaled
#CD300LF 0.04571820 4.370236 CD300LF CA 1.0291080
#CD300LF1 0.03949094 4.144320 CD300LF LN 0.6632240
# re-plot with ggplot2
ggplot(g1$data, aes(x=features.plot, y=id, size=pct.exp, color=id))+
geom_point(show.legend = F)+
scale_color_manual(values=color.head)+
theme_classic(base_size = 14)+
labs(x="", y="")
#