library(plyr) library(tidyverse) library(gridExtra) library(cowplot) library(data.table) #source("CI-Functions.R") source("CI-Functions-Bonferroni.R") defaultpath <- dirname(rstudioapi::getActiveDocumentContext()$path) setwd(defaultpath) path = paste0("plots/4_per_task_learning/raw/") # ALL TASKS tasks <- c("CO", "CH", "SI", "MA") vis_all <- c('storylines', "paohvis") tasks_names <- c('Find \n relationships', 'Characterize \n relationships', 'Similar entities', 'Massive events') plots <- list() # ADD VIS NAMES vis_names <- c('HSL', 'PAOH') titles <- list() titles[[1]] <- NULL i <- 2 for (level in vis_names) { t <- ggdraw() + draw_label(level, x = 0.6) titles[[i]] <- t i <- i + 1 } plots[[1]] <- cowplot::plot_grid(plotlist = titles, nrow = 1, rel_widths = c(0.3, 2, 2)) plots[[1]] for (i in 1:4) { task <- tasks[i] task_name <- tasks_names[i] ## PLOT LABEL df_label <- data.frame( x = c(0), y = c(0), text = c(task_name) ) plot_label <- ggplot(df_label, aes(x, y)) + geom_text(aes(label = text), size=7) + ylim(0, 0) + theme_void() ## STORYLINES vis <- "storylines" # READ TIME filename_time <- paste0(path, 'printed_phase_time_means_task_', task, '_', vis,'.txt', sep='') printed_time <- read.table(filename_time, header = T, sep = ',') colnames(printed_time)[colnames(printed_time)=="upperBound_CI."] <- "upperBound_CI" filename_timediff <- paste0(path, 'printed_phase_time_diffs_task_', task, '_', vis, '.txt', sep='') printed_timediff <- read.table(filename_timediff, header = T, sep = ',') # PLOT TIME analysisData <- c() analysisData$name <- printed_time$phase analysisData$pointEstimate <- printed_time$mean_time analysisData$ci.max <- printed_time$upperBound_CI analysisData$ci.min <- printed_time$lowerBound_CI plot_time_s <- barChart(printed_time, analysisData$name, nbTechs = 2, ymin = 0, ymax = 180, "", "", mycolor='dodgerblue2') ## TIME DIFF analysisData <- c() analysisData$name <- printed_timediff$phase analysisData$pointEstimate <- printed_timediff$mean_time analysisData$ci.max <- printed_timediff$upperBound_CI analysisData$ci.min <- printed_timediff$lowerBound_CI analysisData$level <- printed_timediff$corrected_CI analysisData$ci_corr.max <- printed_timediff$upperBound_CI_corr analysisData$ci_corr.min <- printed_timediff$lowerBound_CI_corr plot_timediff_s <- barChart(printed_timediff, analysisData$name, nbTechs = 1, ymin = -80, ymax = 50, "", "", mycolor='dodgerblue2') ## PAOH Vis vis <- "paohvis" # READ TIME filename_time <- paste0(path, 'printed_phase_time_means_task_', task, '_', vis,'.txt', sep='') printed_time <- read.table(filename_time, header = T, sep = ',') colnames(printed_time)[colnames(printed_time)=="upperBound_CI."] <- "upperBound_CI" filename_timediff <- paste0(path, '/printed_phase_time_diffs_task_', task, '_', vis, '.txt', sep='') printed_timediff <- read.table(filename_timediff, header = T, sep = ',') # PLOT TIME analysisData <- c() analysisData$name <- printed_time$phase analysisData$pointEstimate <- printed_time$mean_time analysisData$ci.max <- printed_time$upperBound_CI analysisData$ci.min <- printed_time$lowerBound_CI plot_time_p <- barChart(printed_time, analysisData$name, nbTechs = 2, ymin = 0, ymax = 180, "", "", mycolor='dodgerblue2') ## TIME DIFF analysisData <- c() analysisData$name <- printed_timediff$phase analysisData$pointEstimate <- printed_timediff$mean_time analysisData$ci.max <- printed_timediff$upperBound_CI analysisData$ci.min <- printed_timediff$lowerBound_CI analysisData$level <- printed_timediff$corrected_CI analysisData$ci_corr.max <- printed_timediff$upperBound_CI_corr analysisData$ci_corr.min <- printed_timediff$lowerBound_CI_corr plot_timediff_p <- barChart(printed_timediff, analysisData$name, nbTechs = 1, ymin = -80, ymax = 50, "", "", mycolor='dodgerblue2') this_grid <- plot_grid( # label plot_grid(plot_label, ncol = 1), # + theme(plot.background = element_rect(color = "black")), ## STORYLINES # time plot_grid(plot_time_s, plot_timediff_s, ncol = 2, rel_widths =c(3, 3)) + theme(plot.background = element_rect(color = "#999999")), ## PAOH Vis # time plot_grid(plot_time_p, plot_timediff_p, ncol = 2, rel_widths =c(3, 3)) + theme(plot.background = element_rect(color = "#999999")), # config #nrow = 3, #rel_heights =c(1, 5, 5) ncol = 3, rel_widths =c(1, 5, 5) ) plots[[i+1]] <- this_grid } final_grid <- plot_grid( # label plots[[1]], # FR plots[[2]], # CR plots[[3]], # SE plots[[4]], # ME plots[[5]], # config nrow = 5, rel_heights =c(1, 5, 5, 5, 5) ) filename <- "plots/4_per_task_learning/time_per_task_all_phases.pdf" ggsave(filename = filename, final_grid, device = "pdf", width=22, height=12)