0
|
1 if (!("ggplot2" %in% rownames(installed.packages()))) {
|
|
2 install.packages("ggplot2", repos="http://cran.xl-mirror.nl/")
|
|
3 }
|
|
4 library(ggplot2)
|
|
5
|
|
6 args <- commandArgs(trailingOnly = TRUE)
|
|
7
|
|
8 vls = args[1]
|
|
9 lbls = args[2]
|
|
10 name = args[3]
|
|
11 output = args[4]
|
|
12
|
|
13 vls = as.numeric(unlist(strsplit(vls, ",")))
|
|
14 lbls = unlist(strsplit(lbls, ","))
|
|
15
|
|
16 pc = ggplot(data.frame(Type=lbls, vls=vls), aes(x = factor(1), y=vls, fill=Type))
|
|
17 pc = pc + geom_bar(width = 1, stat = "identity")
|
|
18 pc = pc + coord_polar(theta="y")
|
|
19 pc = pc + xlab(" ") + ylab(" ") + ggtitle(name)
|
|
20
|
|
21 png(filename=output)
|
|
22 #pie(vls, labels=lbls, col=rainbow(length(vls)), main=name)
|
|
23 pc
|
|
24 dev.off()
|