R2-35 第七次作业 火山图

德先森 2017-12-18 21:17:14 阅读: 1004

library(ggplot2)
library(latex2exp)
p=ggplot(mtcars,aes(factor(cyl)))+geom_bar(aes(fill=factor(gear)),width = 0.6)+labs(title="Here is title",subtitle="Here is subtitle",caption="R2-35",x="cyl")+scale_fill_discrete(name="gear")
mytheme<-theme_classic()+theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank(),legend.position = "none",plot.caption = element_text(face = "bold.italic"))
p
p+mytheme

Rplot02.png


data<-read.csv("7.csv",sep=',',encoding="UTF-8")
data$threshold=as.factor(abs(data$q_value)>5&abs(log2(data$FC))>=1)
data$significant<-ifelse((abs(log2(data$FC))>1&abs(log2(data$q_value))>5),"yes","no")
data$mylables<-ifelse((abs(log2(data$FC))>1 & abs(log2(data$q_value))>5),as.character(data$ X.U.FEFF.Gene.ID),NA)
mysig<-subset(data,significant="yes")
mysig
ydrop=-0.6
textdrop=0.3
myplot<-ggplot(data=mysig,aes(log2(FC),-log2(q_value),col=mylables,size=significant))+geom_point(col="grey70",alpha=1)+geom_point(data = mysig,aes(log2(FC),-log2(q_value),col= mylables),size = 4)+xlim(-2.5,2.7)+ylim(-0.8,15)+scale_size_manual(values=c(0,2))+geom_vline(xintercept=0,linetype=2)+labs(title="CMTM6 sgRNA VS Control",caption="R2-35",x='log2(fold change)',y='-log2(Q value)')+geom_text(aes(label = mylables),size =2,col = "black",fontface = "italic")+annotate("segment", x = 1 , xend = 2.5, y = ydrop,yend =ydrop ,color = "black",size = 1,arrow = arrow(angle = 18,ends = "last",type ="closed")) + annotate("segment", x = -1 , xend = -2.5, y = ydrop,yend = ydrop ,color = "black",size = 1,arrow = arrow(angle = 18,ends = "last",type ="closed")) +annotate("text",x = 1.7,y = textdrop,label = "Upregulated",size =3) +annotate("text",x = -1.7,y = textdrop,label = "Downregulated",size= 3)
myplot
myplot+mytheme

Rplot.png

箭头出来的瞬间,感谢各位的作业参考,真心不易啊,第一次感觉这么的难


 
邀请讨论

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
{{item.nick_name}} 受邀请回答 {{item.create_time}}
{{item.refer_comment.nick_name}} {{item.refer_comment.create_time}}

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
切换到完整回复 发送回复
赞({{item.count_zan}}) 踩({{item.count_cai}}) 删除 回复 关闭
科研狗©2015-2024 科研好助手,京ICP备20005780号-1 建议意见

服务热线

178 0020 3020

微信服务号