结果图
完整代码
代码语言:javascript复制DEGs<-read.csv("volcano_plot_example_data.csv",header=T,stringsAsFactors = F)
dim(DEGs)
df<-DEGs[-log10(DEGs$padj)>25,]
dim(df)
library(ggplot2)
library(ggrepel)
ggplot(DEGs,aes(x=log2FoldChange,y=-log10(padj)))
geom_point(aes(color=change),size=2.5,alpha=1,na.rm = T)
geom_hline(yintercept =-log10(0.05),color="#990000",
linetype="dashed")
geom_vline(xintercept = -2,color="#990000",linetype="dashed")
geom_vline(xintercept = 2,color="#990000",linetype="dashed")
theme_bw(base_size = 14)
scale_color_manual(values=c("red","#00B2FF","orange"))
xlab(expression(log[2]("FoldChange")))
ylab(expression(-log[10]("padj")))
theme(legend.title = element_blank())
ggtitle(label = "Volcano Plot",
subtitle = "Colored by fold-change direction")
geom_label_repel(data=df,aes(x=log2FoldChange,
y=-log10(padj),
label=name,fill=change),
color="white",size=5)
scale_fill_manual(values=c("red","orange"))
guides(fill=F)
需要示例数据的可以给我的公众号留言哈!
ggpubr包做火山图https://rpkgs.datanovia.com/ggpubr/reference/diff_express.html#examples
找到了一些使用R语言分析新型冠状病毒数据的例子
https://www.statsandr.com/blog/top-r-resources-on-covid-19-coronavirus/
Top 100 R resources on Novel COVID-19 Coronavirus
这个链接收集了很多使用R语言分析新型冠状病毒的例子,其中有很多shiny应用,有空的话多看看这些例子的代码。
https://www.r-bloggers.com/facts-about-coronavirus-disease-2019-covid-19-in-5-charts-created-with-r-and-ggplot2/
Facts About Coronavirus Disease 2019 (COVID-19) in 5 Charts created with R and ggplot2
这个链接有5幅漂亮的图片,但是没有发现代码和数据,抽空再找找