服务热线
178 0020 3020
实在懒得画个柱状图了,直接写一句mytheme也是可以用的吧。
>library(ggplot2)
>library(latex2exp)
>plotdata=read.csv(file.choose())
>mytheme=theme_bw()+theme(panel.border = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),axis.line = element_line(colour = "black"),legend.position = "none")
>plotdata$id=plotdata$Gene.ID
>plotdata$q_value=-log2(plotdata$q_value)
>plotdata$FC=log2(plotdata$FC)
>plotdata$threshold=as.factor(ifelse(plotdata$q_value>5,ifelse(abs(plotdata$FC)>1,"yes","not"),"not"))
>yes=subset(plotdata,plotdata$threshold == "yes")
>not=subset(plotdata,plotdata$threshold == "not")
>p = ggplot()+geom_point(data=not,aes(x=FC,y=q_value),color="grey")+geom_point(data=yes,aes(x=FC , y = q_value,color=id),size=2)+xlim(-3,3)+geom_text(data=yes,aes(x=FC,y=q_value,label=yes$id),size = 3, hjust=0,vjust=-1)+geom_vline(xintercept =0,lty=4,col="black")+labs(x = expression(paste(log[2],"(fold change)")),y = expression(paste(-log[2],"(Q value)")))+annotate("segment", x = 1 , xend = 2.5, y= -0.5, yend=-0.5, color = "black", size = 0.5,arrow = arrow(angle = 18,ends = "last",type = "closed"))+annotate("segment", x = -1 , xend = -2.5, y= -0.5, yend=-0.5, color = "black",size = 0.5,arrow = arrow(angle = 18,ends = "last",type = "closed")) +annotate("text",x = 1.7,y=0.5,label = "Upregulated",size = 4.5) +annotate("text",x = -1.7,y=0.5, label = "Downregulated",size = 4.5)
>p+mytheme+ggtitle("R2-29 CC")
附件