R2-06 火山图

dean 2017-12-19 23:39:46 阅读: 320

part1

ggplot(mtcars,aes(factor(cyl)))+geom_bar(aes(fill=factor(gear)))+labs(title="R2-06-dean",subtitle=" ")+scale_fill_discrete(name=" ")

mytheme<-theme_classic()+theme(panel.background=element_rect(color='black'),panel.grid=element_blank(),legend.position = "none",plot.caption = element_text(face = "bold.italic"))

+mytheme


7_1.png


library(ggplot2)

library(latex2exp)


data=read.csv(file.choose())      


head=(data)


data$significant = ifelse(abs(log2(data$FC)) > 1 & data$q_value < 0.05,"yes","no" )


data$mylabels =ifelse(abs(log2(data$FC)) > 1 & data$q_value < 0.05,as.character(data$锘縂ene.ID),NA)


mysig = subset(data,significant == "yes")


mysig


ydrop = -0.6


textdrop = 0.3


myplot = ggplot(data,aes(x = log2(FC) , y = -log2(q_value),size = significant))+geom_point(col = "grey70",alpha = 1) +xlim(-2.5,2.7) +ylim(-0.8,15) +scale_size_manual(values = c(2,0)) +geom_point(data = mysig,aes(x = log2(FC),y = -log2(q_value),col = mylabels),size = 4,position = position_jitter(height = 0.1,width = 0))+geom_text(aes(label = mylabels),size =3,hjust = 0,vjust = -1,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 = 4.5) +annotate("text",x = -1.7,y = textdrop,label = "Downregulated",size = 4.5) +labs(title = "CMTM6 sgRNA2 vs Control",) + labs(x = expression(log[2])) +labs(x = expression(paste(log[2],"(Fold Change)")),y = expression(paste(-log[2],"(Q value)")))


myplot + mytheme

7_2.png

 
请登录后再评论
| 注册
{{item.nickname}} {{item.create_time}} {{item.floor}}楼
{{item.re_nickname}} 写于 {{item.re_time}}
切换到完整回复
科研狗 2015-2020 京ICP备16006621 科研好助手,专业的科研社交共享平台