-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotting.r
123 lines (98 loc) · 3.66 KB
/
plotting.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
library(dplyr)
library(ggplot2)
library(tidyr)
source(file = "init.r")
PlotBoxGrid <- function() {
plotData <- NULL
# Aggregate data for plot
for (m in 1:length(methodNames)) {
for (s in 1:length(systemNames)) {
# Generate data path
dataPath <- file.path("data", "results")
dataPath <- file.path(dataPath,
paste(methodNames[m], "_",
systemNames[s], ".csv", sep = ""))
# Load method/system data
tempData <- read.csv(dataPath,
na.strings = c(".", "NA", "", "?"),
strip.white = TRUE, encoding = "UTF-8")
# Filter data
tempData <- select_(tempData,
.dots = list("SamplingSize", "SobolSampleID",
"MeanRowsError", "SdRowsError"))
# Apply new factor labels
tempData[, "SamplingSize"] <-
factor(tempData[,"SamplingSize"],
labels = c("N", "2*N", "3*N", "4*N", "5*N"))
# Add system column
tempData <- cbind(systemNames[s], tempData)
colnames(tempData)[1] <- "system"
# Add method column
tempData <- cbind(methodNames[m], tempData)
colnames(tempData)[1] <- "method"
# Print
tempData <-tbl_df(tempData)
# print(tempData)
# Update aggregated data
if (is.null(plotData)) {
plotData <- tempData
}
else {
plotData <- bind_rows(plotData, tempData)
}
} # for (s in 1:length(systemNames)) {
} # for (m in 1:length(methodNames)) {
plotData <- tbl_df(plotData)
print(plotData)
plotData$method <- as.factor(plotData$method)
print(plotData$method)
systems01 <- c("Apache", "BerkeleyC", "BerkeleyJ")
systems02 <- c("LLVM", "Sqlite", "x264")
systems03 <- c("Apache", "BerkeleyC", "BerkeleyJ",
"LLVM", "Sqlite", "x264")
plotData01 <- filter(plotData, system %in% systems01)
plotData02 <- filter(plotData, system %in% systems02)
plotData03 <- filter(plotData, system %in% systems03)
plotPath01 <- file.path("data", "results", "FACET_BOXPLOT_01.png")
plotPath02 <- file.path("data", "results", "FACET_BOXPLOT_02.png")
plotPath03 <- file.path("data", "results", "FACET_BOXPLOT_03.png")
# Generate plot 01
dataPlot <-
ggplot(data = plotData01,
aes_string(x = "SamplingSize", y = "MeanRowsError",
fill = "SamplingSize")) +
stat_boxplot(geom ='errorbar') +
geom_boxplot() +
scale_fill_grey(start = 0.5, end = 1) +
facet_grid(system~method, scales = "free") +
xlab("Sampling Size") +
ylab("Relative Error (%)") +
guides(fill = FALSE)
ggsave(dataPlot, filename = plotPath01, width = 8.5, height = 11)
# Generate plot 02
dataPlot <-
ggplot(data = plotData02,
aes_string(x = "SamplingSize", y = "MeanRowsError",
fill = "SamplingSize")) +
stat_boxplot(geom ='errorbar') +
geom_boxplot() +
scale_fill_grey(start = 0.5, end = 1) +
facet_grid(system~method, scales = "free") +
xlab("Sampling Size") +
ylab("Relative Error (%)") +
guides(fill = FALSE)
ggsave(dataPlot, filename = plotPath02, width = 8.5, height = 11)
# Generate plot 03
dataPlot <-
ggplot(data = plotData03,
aes_string(x = "SamplingSize", y = "MeanRowsError",
fill = "SamplingSize")) +
stat_boxplot(geom ='errorbar') +
geom_boxplot() +
scale_fill_grey(start = 0.5, end = 1) +
facet_grid(system~method, scales = "free") +
xlab("Sampling Size") +
ylab("Relative Error (%)") +
guides(fill = FALSE)
ggsave(dataPlot, filename = plotPath03, width = 8.5, height = 11)
}