-
Notifications
You must be signed in to change notification settings - Fork 0
/
figure-who-rows.R
47 lines (40 loc) · 1.18 KB
/
figure-who-rows.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
source("packages.R")
pkg.color <- c(
"data.table::melt"="#1B9E77",
"reshape2::melt"="#D95F02",
"tidyr::gather"="#7570B3",
"tidyr::pivot_longer"="#7570B3",
"cdata::unpivot_to_blocks"="#E7298A",
"cdata::rowrecs_to_blocks"="#E7298A",
"nc::capture_melt_single"="#66A61E",
"stats::reshape"="#E6AB02",
"#A6761D", "#666666")
who.timings <- readRDS("figure-who-rows-data.rds")
who.timings[, seconds := time/1e9]
stats.timings <- who.timings[, .(
median=median(seconds),
q25=quantile(seconds, 0.25),
q75=quantile(seconds, 0.75)
), by=.(N.rows, expr)]
gg <- ggplot()+
theme_bw()+
scale_color_manual(values=pkg.color)+
scale_fill_manual(values=pkg.color)+
geom_ribbon(aes(
N.rows, ymin=q25, ymax=q75, fill=expr),
alpha=0.2,
data=stats.timings)+
geom_line(aes(
N.rows, median, color=expr),
data=stats.timings)+
scale_x_log10(
breaks=10^seq(1, 5, by=1),
limits=c(NA, max(stats.timings$N.rows)*20))+
scale_y_log10("Computation time (seconds)")
dl <- directlabels::direct.label(gg, list(cex=0.8, "last.polygons"))
pdf("figure-who-rows.pdf", 7, 2.3)
print(dl)
dev.off()
png("figure-who-rows.png", 7, 2.3, units="in", res=100)
print(dl)
dev.off()