原创 TS的美梦 KS科研分享与服务 2022-04-28 10:40
这次真的和火山图杠上了,我就不信了还复现不完奇奇怪怪的火山图?在一篇文章中看到了一种呈现方式,其实大同小异,但是还是练习下有些画法。此外,小伙伴们又看到新奇的火山图,可截图联系我们,争取将火山图打下来。
来源:[1]S García-Silva, A Benito-Martín, S Sánchez-Redondo, et al. Correction: Use of extracellular vesicles from lymphatic drainage as surrogate markers of melanoma progression and BRAF V600E mutation[J]. Journal of Experimental Medicine, 2019, 216(5):jem.2018152204162019c.
加载数据和ggplot2
setwd("E:/生物信息学/ggplot火山图")
df <- read.csv("DEG.csv",header = T)
library(ggplot2)
接下来作图即可。需要完成的是画出散点图,加上分割线,还有对不同的区域填充颜色,这个做法我们之前的文章提到过(不好好做图的NSC系列(八):ggplot2重现Nature文章多组柱状图+散点,这是一场硬仗),最后在合适位置加上文字标注即可。
#画图
library(ggplot2)
ggplot(df, aes(x=avg_log2FC, y=-log10(p_val_adj))) +
geom_hline(aes(yintercept=1.3), color = "#999999", linetype="dashed", size=1)+
geom_vline(aes(xintercept= -0.25), color = "#999999", linetype="dashed", size=1)+
geom_vline(aes(xintercept= 0.25), color = "#999999", linetype="dashed", size=1)+
geom_rect(aes(xmin=-Inf,
xmax=-0.25,
ymin=0,
ymax=Inf),
fill='blanchedalmond',color='grey90')+
geom_rect(aes(xmin=Inf,
xmax=0.25,
ymin=0,
ymax=Inf),
fill='blanchedalmond',color='grey90')+
geom_point(size=3, shape=21, color="black") +
labs(x = "Log2 fold change",y = "-Log10(P-value)", title = "") +
theme_bw() +
theme(panel.grid.major=element_blank(),
panel.grid.minor=element_blank(),
panel.border = element_blank(),
axis.line = element_line(colour = "black",size = 0.5),
axis.title =element_text(size = 14),
axis.text =element_text(size = 12, color = "black"))+
annotate("text", label = "Down-regulated DEGs\nin treatment",
x = -2.2, y = 250, size=5)+
annotate("text", label = "Up-regulated DEGs\nin treatment",
x = 2.2, y = 250, size= 5)
今天的分享就到这了,欢迎小伙伴发图,一起把他啃下来!
如有侵权,请联系本站删除!