36 lines
1.2 KiB
R
36 lines
1.2 KiB
R
#!/usr/bin/env Rscript
|
|
source("common.R")
|
|
|
|
parser <- fig_parser(description = "Throughput bar chart")
|
|
parser$add_argument("--ymin", type = "double")
|
|
parser$add_argument("--ymax", type = "double")
|
|
parser$add_argument("--ystep", type = "double")
|
|
args <- parser$parse_args()
|
|
|
|
runs <- read_csv(file.path(args$data, "runs.csv"), show_col_types = FALSE) %>%
|
|
prepare_solution() %>%
|
|
group_by(solution) %>%
|
|
summarise(mean_gbps = mean(throughput_bps) / 1e9,
|
|
sd_gbps = sd(throughput_bps) / 1e9, .groups = "drop")
|
|
|
|
p <- ggplot(runs, aes(x = solution, y = mean_gbps, fill = solution)) +
|
|
geom_col(width = 0.6, colour = "black") +
|
|
geom_errorbar(aes(ymin = mean_gbps - sd_gbps, ymax = mean_gbps + sd_gbps),
|
|
width = 0.2) +
|
|
scale_fill_manual(values = LABEL_COLORS, guide = "none") +
|
|
labs(x = NULL, y = "Throughput (Gbps)") +
|
|
theme_paper() +
|
|
theme(axis.text.x = element_text(angle = 45, hjust = 1),
|
|
plot.margin = margin(2, 4, 0, 2)) +
|
|
theme_debug_margins(args)
|
|
|
|
if (!is.null(args$ymax)) {
|
|
ymin <- if (is.null(args$ymin)) 0 else args$ymin
|
|
p <- p + coord_cartesian(ylim = c(ymin, args$ymax))
|
|
if (!is.null(args$ystep)) {
|
|
p <- p + scale_y_continuous(breaks = seq(ymin, args$ymax, args$ystep))
|
|
}
|
|
}
|
|
|
|
save_figure(p, args)
|