-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.r
72 lines (64 loc) · 2.31 KB
/
plot.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
library('ggplot2')
options(scipen = 20)
plotByScenario <- function(data)
{
ggplot(data,
aes(x = Scenario, y = Mean, fill = Implementation),
environment = environment()) +
geom_bar(stat = "identity",
colour = "black",
position = position_dodge()) +
geom_errorbar(aes(ymin = MeanL, ymax = MeanU),
position = position_dodge(0.9),
width = 0.2) +
facet_wrap( ~ Scenario, scales = "free") +
labs(y = "Execution time (s)") + theme_linedraw() +
theme(
panel.grid.major.x = element_blank(),
axis.text.x = element_blank(),
axis.ticks.x = element_blank()
)
}
plotByImplementation <- function(data)
{
ggplot(data, aes(x = Implementation, y = Mean, fill = Scenario)) +
geom_bar(stat = "identity",
colour = "black",
position = position_dodge()) +
geom_errorbar(aes(ymin = MeanL, ymax = MeanU),
position = position_dodge(0.9),
width = 0.2) +
theme_linedraw() +
facet_wrap(~ Implementation, scales = "free") +
theme(
panel.grid.major.x = element_blank(),
axis.text.x = element_blank(),
axis.ticks.x = element_blank()
) +
labs(y = "Execution time (s)")
}
loadData <- function(file)
{
data <-
read.csv(
file,
header = FALSE,
col.names = c("Implementation", "Scenario", "Mean", "MeanL", "MeanU")
)
data$Scenario <- as.character(data$Scenario)
data$Scenario <-
factor(data$Scenario, level = unique(data$Scenario))
data
}
BigStack <- loadData('big-stack.csv')
plotByScenario(BigStack) + labs(title = "BigStack (by scenario)")
plotByImplementation(BigStack) + labs(title = "BigStack (by implementation)")
Countdown <- loadData('countdown.csv')
plotByScenario(Countdown) + labs(title = "Countdown (by n)", x = "n")
plotByImplementation(Countdown) + labs(title = "Countdown (by implementation)")
FileSizes <- loadData('file-sizes.csv')
plotByScenario(FileSizes) + labs(title = "FileSizes (by scenario)")
plotByImplementation(FileSizes) + labs(title = "FileSizes (by implementation)")
Reinterpretation <- loadData('reinterpretation.csv')
plotByScenario(Reinterpretation) + labs(title = "Reinterpretation (by scenario)")
plotByImplementation(Reinterpretation) + labs(title = "Reinterpretation (by implementation)")