Update charts to account for new datafile/charts folders

This commit is contained in:
2026-09-18 19:57:13 +02:00
parent 731701c991
commit a3e341cf27
12 changed files with 200 additions and 83 deletions
@@ -3,25 +3,33 @@ library(dplyr)
library(readr)
library(stringr)
# Usage: Rscript ratio_comparison_merged_trap.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
# Usage: Rscript combined_ratio_comparison_merged.r exp1 exp2 ... queries_dir charts_dir [resultsdata_file]
# Sums all benchmarks, merges GROUP1_MARKER into TRAP
args <- commandArgs(trailingOnly = TRUE)
if (length(args) < 2) {
stop("Need at least 2 experiments")
}
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
args[length(args)]
} else {
"resultsdata.csv"
}
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
args[-length(args)]
} else {
args
}
if (length(tail_args) < 4) {
stop(paste(
"Usage: combined_ratio_comparison_merged.r",
"<exp1> <exp2> ... <queries_dir> <charts_dir> [resultsdata_file]"
))
}
charts_dir <- tail_args[length(tail_args)]
queries_dir <- tail_args[length(tail_args) - 1]
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
extract_info <- function(path) {
dir_name <- basename(path)
match <- str_match(
@@ -43,7 +51,7 @@ for (arg in exp_args) {
next
}
csv_file <- file.path(info$path, csv_suffix)
csv_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
if (!file.exists(csv_file)) {
warning(paste("Missing:", csv_file))
next
@@ -102,7 +110,11 @@ plot <- ggplot(
)
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
outfile <- paste0("injections/ratio_comparison_merged_trap", suffix, ".svg")
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
outfile <- file.path(
charts_dir,
paste0("ratio_comparison_merged_trap", suffix, ".svg")
)
ggsave(
outfile,
plot = plot,