42 lines
1.4 KiB
R
42 lines
1.4 KiB
R
#!/usr/bin/env Rscript
|
|
source("common.R")
|
|
|
|
parser <- fig_parser(description = "RTT box plot")
|
|
parser$add_argument("--ymin", type = "double", default = 4)
|
|
parser$add_argument("--ymax", type = "double", default = 14)
|
|
parser$add_argument("--ystep", type = "double", default = 2)
|
|
args <- parser$parse_args()
|
|
|
|
stats <- read_csv(file.path(args$data, "rtts.csv"), show_col_types = FALSE) %>%
|
|
mutate(rtt_ms = rtt_us / 1000) %>%
|
|
prepare_solution() %>%
|
|
group_by(solution) %>%
|
|
summarise(
|
|
ymin = quantile(rtt_ms, 0.05),
|
|
lower = quantile(rtt_ms, 0.25),
|
|
middle = median(rtt_ms),
|
|
upper = quantile(rtt_ms, 0.75),
|
|
ymax = quantile(rtt_ms, 0.95),
|
|
.groups = "drop"
|
|
)
|
|
|
|
p <- ggplot(stats, aes(x = solution, fill = solution)) +
|
|
geom_boxplot(aes(ymin = ymin, lower = lower, middle = middle,
|
|
upper = upper, ymax = ymax),
|
|
stat = "identity", width = 0.6, colour = "black") +
|
|
scale_fill_manual(values = LABEL_COLORS, guide = "none") +
|
|
labs(x = NULL, y = "RTT (ms)") +
|
|
theme_paper() +
|
|
theme(axis.text.x = element_text(angle = 45, hjust = 1),
|
|
plot.margin = margin(2, 4, 0, 2)) +
|
|
theme_debug_margins(args)
|
|
|
|
if (args$zoom) {
|
|
p <- p + coord_cartesian(ylim = c(args$ymin, args$ymax)) +
|
|
scale_y_continuous(breaks = seq(args$ymin, args$ymax, args$ystep))
|
|
} else {
|
|
p <- p + coord_cartesian(ylim = c(0, NA))
|
|
}
|
|
|
|
save_figure(p, args)
|