Files
tso-paper-eval/figures/fig_sender_cpu.R
T
2026-05-27 21:00:28 +02:00

28 lines
967 B
R

#!/usr/bin/env Rscript
source("common.R")
parser <- fig_parser(description = "Sender CPU bar chart")
parser$add_argument("--ystep", type = "double",
help = "y-axis major tick spacing (omit = auto)")
args <- parser$parse_args()
runs <- read_csv(file.path(args$data, "runs.csv"), show_col_types = FALSE) %>%
prepare_solution() %>%
group_by(solution) %>%
summarise(mean_pct = mean(cpu_sender),
sd_pct = sd(cpu_sender), .groups = "drop")
p <- ggplot(runs, aes(x = solution, y = mean_pct, fill = solution)) +
geom_col(width = 0.6, colour = "black") +
geom_errorbar(aes(ymin = mean_pct - sd_pct, ymax = mean_pct + sd_pct),
width = 0.2) +
scale_fill_manual(values = LABEL_COLORS, guide = "none") +
labs(x = NULL, y = paste0("Average CPU usage (", pct_sign(), ")")) +
theme_paper()
if (!is.null(args$ystep)) {
p <- p + scale_y_continuous(breaks = scales::breaks_width(args$ystep))
}
save_figure(p, args)