R07

作者: rong酱 | 来源:发表于2021-09-28 21:41 被阅读0次

绘制条形图

library('ggplot2')
df1=read.table('1.txt', sep='\t', header=T)
png('out1.png', width=1300*2, height=800*2, res=72*2)
p <- ggplot(df1,aes(x=stat,y=num,fill=stat))+ scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+geom_bar(stat = "identity",width = 1)+geom_text(aes(label=num), vjust=1.6, color="white", size=5)+theme_minimal()
p <- p + theme_bw()
p <- p + scale_x_discrete(limits=c("Up","Down"))+ylim(0,max(df1$num))
p <- p + theme(plot.title = element_text(face = "bold",size = 20, hjust = 1))
p <- p + theme(axis.text.y = element_text(face = "bold",size = 12, hjust = 0.5))
p <- p + theme(axis.title.y = element_text(face = "bold",size = 20, hjust = 0.5))
p <- p + theme(axis.text.x = element_text(face = "bold",size = 12, hjust = 0.5))
p <- p + theme(axis.title.x = element_text(face = "bold",size = 20, hjust = 0.5))
p <- p + theme(legend.title = element_blank())
p <- p + theme(panel.border = element_rect(colour = "black", fill=NA, size=0.5),panel.background = element_rect(fill = NA, color = "black"),panel.grid.major.x = element_blank())
p <- p + labs(title="DiffExp Genes Statistics",x = 'A-VS-B', y = 'Number of Genes')
p <- p + theme(plot.title = element_text(hjust = 0.5,size = 20))
p
dev.off()

相关文章

  • R07

    绘制条形图

网友评论

      本文标题:R07

      本文链接:https://www.haomeiwen.com/subject/ybcsnltx.html