DotPlot | 重绘点图,指定cell type的颜色

2024-01-01 17:50:10

1 效果

左边是默认,右边是自定义颜色后。
在这里插入图片描述

2 代码

# 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="")
#

文章来源:https://blog.csdn.net/wangjunliang/article/details/135326471
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。