介绍:利用ggplot2绘制barplot
脚本:barplot.r
library(ggplot2)
#library(patchwork)
mytheme2 <- theme_bw() + theme(legend.title=element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.text.x=element_text(size=6,angle=0), legend.position="top")
data1 <- read.table("Count.of.group.combinations.lst", header = TRUE, sep="\t")
p1 <- ggplot(data1, aes(x=Count, y=GeneNum)) +
geom_bar(stat = "identity", position="stack", width=0.7, colour="#fe4365", fill="#fe4365") + mytheme2 + ylab("Gene number")
#p1 + plot_layout(ncol = 1, nrow=1)
ggsave(file="Genes_in_diff_combinations.pdf",plot=p1, width = 5, height = 4)
输入文件(Count.of.group.combinations.lst)格式:
Count GeneNum
1 1527
2 1118
3 865
4 695
5 560
6 428
7 266
网友评论