OSDN Git Service

* [shogi-server] Support a graceful shutdown. (Closes #38544)
[shogi-server/shogi-server.git] / utils / histogram.R
1 args <- commandArgs(TRUE)
2 file1<- args[1]
3 file2 <- args[2]
4 title <- args[3]
5
6 print(file)
7
8 d1 <- read.csv(file1, header=F)
9 d2 <- read.csv(file2, header=F)
10
11 sink(file="summary1.txt", split=T)
12 summary(d1)
13 sink()
14
15 con <- file("summary1.txt")
16 open(con)
17 summary_text <- readLines(con)
18 close(con)
19
20 sink(file="summary2.txt", split=T)
21 summary(d2)
22 sink()
23
24 con <- file("summary2.txt")
25 open(con)
26 summary_text <- readLines(con)
27 close(con)
28
29
30 png(sprintf("%s.png", file1))
31
32 library(MASS)
33 par(mar = c(4.5, 4.5, 4.5, 5.5))
34
35 max <- 60
36
37 truehist(d1$V1, xlim=c(0,max), col="#66ff6640", border="#66ff66", axes = FALSE, xlab = "", ylab = "", prob=FALSE)
38 axis(side = 1)                                          # x axis
39 axis(side = 2, col.axis = "#66ff66", col = "#66ff66")   # left y axis
40 mtext("floodgate-900-0", side = 2, line=3)
41
42 par(new = TRUE)
43
44 truehist(d2$V1, xlim=c(0,max), col="#6699ff40", border="#6699ff", axes = FALSE, xlab = "", ylab = "", prob=FALSE) 
45 axis(side = 4, col.axis = "#6699ff", col = "#6699ff")   # right y axis
46 mtext("floodgate-600-0", side = 4, line=3)
47
48 mtext(title, side=1, line=3)
49
50 dev.off()
51 q()
52
53