今天我们复现一幅2022年3月发表在Cell
上的抖动散点图
。
Title:Tissue-resident FOLR2+ macrophages associate with CD8+ T cell infiltration in human breast cancer
DOI:https://doi.org/10.1016/j.cell.2022.02.021
之前复现过的散点图:
![a627ad997409432c7f256a67f0eba540.png](https://img-blog.csdnimg.cn/img_convert/a627ad997409432c7f256a67f0eba540.png)
读图
本期抖动散点图
亮点:
与
蜂群图
不同,只是单纯的抖动散点图
。y轴刻度
log10
转换x轴刻度标签
修改,上标
的添加。差异结果注释在图形区域外。
结果展示
![bc7875f985e452cb4d38f246b2a2f9c8.png](https://img-blog.csdnimg.cn/img_convert/bc7875f985e452cb4d38f246b2a2f9c8.png)
示例数据和代码领取
点赞
、在看
本文,分享至朋友圈集赞20个
并保留30分钟
,截图发至微信mzbj0002
领取。
木舟笔记2022年度VIP可免费领取。
木舟笔记2022年度VIP企划
权益:
2022年度木舟笔记所有推文示例数据及代码(在VIP群里实时更新)。
木舟笔记科研交流群。
半价购买
跟着Cell学作图系列合集
(免费教程+代码领取)|跟着Cell学作图系列合集。
收费:
99¥/人。可添加微信:mzbj0002
转账,或直接在文末打赏。
![37ec163d8b40870d545eaf6a4571fd04.png](https://img-blog.csdnimg.cn/img_convert/37ec163d8b40870d545eaf6a4571fd04.png)
绘制
# 示例数据准备及预处理
gene = data.frame( A = runif(100,2,900),
B = runif(100,0.1,5))
# 长宽转换
library(reshape2)
gene_exp = melt(gene,
measure.vars = c("A","B"),
variable.name = "gene",value.name = "exp")
# 绘制
library(ggplot2)
library(ggpubr)
p <- ggplot(gene_exp,aes(x = gene, y = exp),color = 'balck')+
geom_jitter(aes(fill = gene),
width = 0.2,
height =0,
size = 3,
shape = 21,
stroke = 0.4,
show.legend = FALSE)+
scale_fill_manual(values = c("#bc382d","#314494"))+
## 先算一下显著性差异,再手动添加
# geom_signif(comparisons = list(c("A","B")),
# test = "t.test",
# map_signif_level = T)+
scale_y_log10()+
scale_x_discrete(labels = c('',''))+
xlab(" ") +
theme_classic()
p
p1 <- p +
coord_cartesian(clip = 'off',ylim = c(0.1,1000))+ #在非图形区域绘图,且要定好y轴范围
theme(plot.margin = margin(0.5,0,0,0.5,'cm'))+ #自定义图片上左下右的边框宽度
annotate('segment',x=1,xend=2,y=1500,yend=1500,color='black',cex=.4)+
annotate("text", x = 1.5, y = 1500, label ="***",size = 6)+
annotate("text",label = bquote (FOLR^high),x=1,y=0.03)+
annotate("text",label = bquote (FOLR^low),x=2,y=0.03)
p1
![889e99566fa2afc0b70fe14faa869a14.png](https://img-blog.csdnimg.cn/img_convert/889e99566fa2afc0b70fe14faa869a14.png)
往期内容
![20fdf3095e7c79ae4f375ff19a425ada.png](https://img-blog.csdnimg.cn/img_convert/20fdf3095e7c79ae4f375ff19a425ada.png)