R2-40-第七次作业-火山图

barcaqiu 2017-12-17 23:10:50 阅读: 1067

>library("ggplot2")

> g<-ggplot(mtcars,aes(factor(cyl)))+geom_bar(aes(fill=factor(gear)),width = 0.3)+labs(title="R-40",subtitle="Here is MTCARS",caption="2017-12-17",x="cyl")+scale_fill_discrete(name="gear")

> g

raw_1.png

> mytheme<- theme_classic()+theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank(),legend.position = "none",plot.caption = element_text(face = "bold.italic"))

> g+mytheme

raw_2.png


>library("ggplot2")

>mydata<-read.csv("D:\\learningr\\R2_7.csv",header = TRUE)

>mydata$threshold=as.factor(mydata$q_value<0.05&abs(log2(mydata$FC))>=1)

>mydata$mylabels<-ifelse(mydata$q_value<0.05&abs(log2(mydata$FC))>=1,as.character(mydata$Gene.ID))

>ggplot(data=mydata,aes(x=log2(FC),y=log2(q_value),colour=mylabels))+geom_point(alpha=1)+xlim(-2.5,2.7)+ylim(-0.8,15)

+geom_text(aes(label=mylabels),size=3,hjust=0,vjust=-1,colour="black",fontface="italic")+geom_vline(xintercept=c(-1,1),lty=4,col="grey",lwd=0.5)

+ geom_hline(yintercept =-log2(0.05),lty=4,col="grey",lwd=0.5)+theme_bw()

+ggtitle("CMTM6 sgRNA2 vs Control-R-40")

+annotate("segment",x=1,xend=2.5,y=-0.5,yend=-0.5,size=0.5,arrow=arrow(angle = 18,ends = "last",type="closed"))+annotate("segment",x=-1,xend=-2.5,y=-0.5,yend=-0.5,size=0.5,arrow=arrow(angle = 18,ends = "last",type="closed"))

+annotate("text",x=1.7,y=0.3,label="upregulated",size=4)+annotate("text",x=-1.7,y=0.3,label="downregulated",size=4)+mytheme

Rplot-R40.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

微信服务号