Files
failnix/scripts/charts/single_result.r
T

33 lines
954 B
R

library(ggplot2)
# Usage: Rscript single_result.r exp_name queries_dir charts_dir [resultsdata_file]
args <- commandArgs(trailingOnly = TRUE)
experiment <- args[1]
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(queries_dir, paste0(experiment, "_", resultsdata_file))
if (!file.exists(datafile)) {
print(paste("Input file", datafile, "is missing"))
stop()
}
data <- readr::read_csv(datafile)
tibble::glimpse(data)
plot <- ggplot(data, aes(x = benchmark, y = faults, fill = resulttype)) +
geom_col(position = "dodge") +
scale_y_log10() +
labs(x = "Benchmark", y = "Faults", fill = "Result Type") +
theme_minimal()
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
ggsave(
file.path(charts_dir, paste0(experiment, "_single_result", suffix, ".svg")),
plot = plot,
)