服务热线
178 0020 3020
>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
> 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
>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
附件