-
Notifications
You must be signed in to change notification settings - Fork 30
/
sp_configure.sh
56 lines (45 loc) · 1.21 KB
/
sp_configure.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
function ggplot2_configure {
cat <<END >>${file}${mid}.r
#Configure the canvas
#legend.title=element_blank(),
p <- p + theme_bw() + theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.key=element_blank())
if (${xtics_angle} != 0){
if (${xtics_angle} == 90){
p <- p + theme(axis.text.x=
element_text(angle=${xtics_angle},hjust=1, vjust=0.5))
}else if (${xtics_angle} == 45){
p <- p + theme(axis.text.x=
element_text(angle=${xtics_angle},hjust=0.5, vjust=0.5))
} else {
p <- p + theme(axis.text.x=
element_text(angle=${xtics_angle},hjust=0.5, vjust=0.5))
}
}
#Set the position of legend
top='top'
botttom='bottom'
left='left'
right='right'
none='none'
legend_pos_par <- ${legend_pos}
p <- p + theme(legend.position=legend_pos_par)
#add additional ggplot2 supported commands
p <- p${par}
# output pictures
if ("${ext}" == "pdf") {
ggsave(p, filename="${file}${mid}.${ext}", dpi=$res, width=$uwid,
height=$vhig, units=c("cm"),colormodel="${colormodel}")
} else {
ggsave(p, filename="${file}${mid}.${ext}", dpi=$res, width=$uwid,
height=$vhig, units=c("cm"))
}
#png(filename="${file}${mid}.png", width=$uwid, height=$vhig,
#res=$res)
#p
#dev.off()
END
}