使用ggplot2绘制折线图
输入文件格式:
depth count
1 560375582
2 38362613
3 10277188
4 6580683
5 7307379
绘图脚本
library(ggplot2)
mytheme2 <- theme_bw() + theme(legend.title=element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_text(size=8,angle=90),
#axis.title.y = element_text(size=8,angle=90),
axis.text.x=element_text(size=9,angle=0),
axis.text.y = element_text(size=7), ##- biao qian
#axis.ticks.y = element_blank(), ##- ke du xian
legend.position="none",
legend.key.size = unit(0.4,'cm'),
legend.text = element_text(size=6,angle=0),
strip.text = element_text(size=8)
)
argv<-commandArgs(TRUE)
data <- read.table(argv[1], header = T, sep=" ")
p1 <- ggplot(data, aes(x=depth, y=count)) +
geom_line(color="red") +
xlim(0, 30) +
ylab("Count") + mytheme2
ggsave(filename="kmer.depth.count.pdf",plot=p1,height=4,width=5)
image.png
网友评论