-
Notifications
You must be signed in to change notification settings - Fork 0
/
06.line_chart.R
36 lines (30 loc) · 1.27 KB
/
06.line_chart.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
args <- commandArgs(TRUE)
input <- args[1]
out <- args[2]
library(ggplot2)
data = read.table("year_distribution.test", header = T)
p = ggplot(data , aes(x=reorder(factor(data$year),data$order), y = data$count, group= data$gene, colour = data$gene))
p<-p+geom_line(size=0.5)#折线大小设置
p<-p+geom_point(size=1)#散点大小设置
theme_zg <- function(..., bg='white'){
require(grid)
theme_classic(...) +
theme(rect=element_rect(fill=bg),
plot.margin=unit(rep(0.5,4), 'lines'),
panel.background=element_rect(fill='transparent', color='black'),
panel.border= element_blank(),
panel.grid=element_blank(),
axis.title = element_text(color='black', vjust=0.1),
plot.title=element_text(hjust=0.5),#设置主标题的位置
#axis.ticks.length = unit(-0.4,"lines"),
#axis.ticks = element_line(color='black'),
#axis.ticks.margin = unit(0.8,"lines"),
axis.line = element_line(size=0.1, colour = "black"),
legend.title=element_blank(),
legend.key=element_rect(fill='transparent', color='transparent'))
}
p =p + theme_zg() + theme(axis.text.x=element_text(angle= 90,hjust= 0.8 ) ) +
ylab("Number of articles")+
xlab("Year")
#labs(title = "Boxplot for RPM values")
ggsave(p,file=out, width=8,height=6)