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
+8 -4
View File
@@ -1,12 +1,15 @@
library(ggplot2)
# Usage: Rscript single_result.r exp_abspath [resultsdata_file]
# Usage: Rscript single_result.r exp_name queries_dir charts_dir [resultsdata_file]
args <- commandArgs(trailingOnly = TRUE)
experiment <- args[1]
resultsdata_file <- if (length(args) >= 2) args[2] else "resultsdata.csv"
queries_dir <- args[2]
charts_dir <- args[3]
resultsdata_file <-
if (length(args) >= 4) args[4] else "resultsdata.csv"
suffix <- gsub("^resultsdata|\\.csv$", "", resultsdata_file)
datafile <- file.path(experiment, resultsdata_file)
datafile <- file.path(queries_dir, paste0(experiment, "_", resultsdata_file))
if (!file.exists(datafile)) {
print(paste("Input file", datafile, "is missing"))
@@ -22,7 +25,8 @@ plot <- ggplot(data, aes(x = benchmark, y = faults, fill = resulttype)) +
labs(x = "Benchmark", y = "Faults", fill = "Result Type") +
theme_minimal()
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
ggsave(
paste0(experiment, "/single_result", suffix, ".svg"),
file.path(charts_dir, paste0(experiment, "_single_result", suffix, ".svg")),
plot = plot,
)