Update charts to account for new datafile/charts folders
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
library(ggplot2)
|
||||
|
||||
# Usage: Rscript single_scatter.r exp_abspath
|
||||
# Usage: Rscript single_scatter.r exp_name queries_dir charts_dir [faults_file]
|
||||
|
||||
# TODO: Allow filtering resulttypes (or at least exclude OK_MARKER)
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
experiment <- args[1]
|
||||
faults_file <- if (length(args) >= 2) args[2] else "faults.csv"
|
||||
queries_dir <- args[2]
|
||||
charts_dir <- args[3]
|
||||
faults_file <- if (length(args) >= 4) args[4] else "faults.csv"
|
||||
suffix <- gsub("^faults|\\.csv$", "", faults_file)
|
||||
datafile <- file.path(experiment, faults_file)
|
||||
datafile <- file.path(queries_dir, paste0(experiment, "_", faults_file))
|
||||
|
||||
if (!file.exists(datafile)) {
|
||||
print(paste("Input file", datafile, "is missing"))
|
||||
@@ -28,7 +30,8 @@ plot <- ggplot(data, aes(x = fault_address, y = faults)) +
|
||||
labs(x = "Address", y = "Faults", color = "Type") +
|
||||
theme_minimal()
|
||||
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
ggsave(
|
||||
paste0(experiment, "/scatter", suffix, ".svg"),
|
||||
file.path(charts_dir, paste0(experiment, "_scatter", suffix, ".svg")),
|
||||
plot = plot,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user