library(plyr) library(tidyverse) library(gridExtra) library(cowplot) library(data.table) library(extrafont) loadfonts(device = "win") par(family = "LM Roman 10") #source("CI-Functions.R") source("CI-Functions-Bonferroni.R") defaultpath <- dirname(rstudioapi::getActiveDocumentContext()$path) setwd(defaultpath) # ALL TASKS path <- "plots/all_tasks_mapSize/raw/" plots <- list() vis_all <- c("GlyMa","CoordV", "LocSto") vis_names <- c("Glyph Maps","Coordinated Views", "Location Storylines") metrics <- c('time', 'error') metrics_colors <- c('dodgerblue2', 'darkorange3') task <- 'all' task_name <- 'all' xmin <- c(0, 0) xmax <- c(50, 10) xmin_diff <- c(-10, -10) xmax_diff <- c(10, 10) v <- 2 m <- 1 for (v in 1:3) { vis = vis_all[v] vis_name = vis_names[v] metrics_plots <-list() ## PLOT LABEL df_label <- data.frame( x = c(0), y = c(0), text = c(task_name) ) metrics_plots[[1]] <- ggplot(df_label, aes(x, y)) + geom_text(aes(label = vis_name), size=7) + ylim(0, 0) + theme_void() for (m in 1:2) { metric <- metrics[m] # READ METRIC filename_metric <- paste0(path,'printed_phase_', metric, '_means_task_', task, '_', vis,'.txt', sep='') printed_metric <- read.table(filename_metric, header = T, sep = ',') colnames(printed_metric)[colnames(printed_metric)=="upperBound_CI."] <- "upperBound_CI" #printed_metric$vis <- factor(printed_metric$phase, levels=rev(levels(printed_metric$phase))) filename_metricdiff <- paste0(path,'printed_phase_', metric,'_diffs_task_', task, '_', vis, '.txt', sep='') printed_metricdiff <- read.table(filename_metricdiff, header = T, sep = ',') #printed_metricdiff$phase <- factor(printed_metricdiff$phase, levels=c("Adv-Explo")) # PLOT METRIC analysisData <- c() analysisData$name <- printed_metric$phase analysisData$pointEstimate <- printed_metric$mean_metric analysisData$ci.max <- printed_metric$upperBound_CI analysisData$ci.min <- printed_metric$lowerBound_CI plot_metric <- barChart(printed_metric, analysisData$name, nbTechs = 2, ymin = xmin[[m]], ymax = xmax[[m]], "", "", mycolor=metrics_colors[m]) metrics_plots[[m*2]] <- plot_metric ## METRIC DIFF analysisData <- c() analysisData$name <- printed_metricdiff$phase analysisData$pointEstimate <- printed_metricdiff$mean_metric analysisData$ci.max <- printed_metricdiff$upperBound_CI analysisData$ci.min <- printed_metricdiff$lowerBound_CI analysisData$level <- printed_metricdiff$corrected_CI analysisData$ci_corr.max <- printed_metricdiff$upperBound_CI_corr analysisData$ci_corr.min <- printed_metricdiff$lowerBound_CI_corr plot_diff <- barChart(printed_metricdiff, analysisData$name, nbTechs = 1, ymin = xmin_diff[[m]], ymax = xmax_diff[[m]], "", "", mycolor=metrics_colors[m]) metrics_plots[[(m * 2) + 1]] <- plot_diff } this_grid <- plot_grid( # label plot_grid(metrics_plots[[1]], ncol = 1), # + theme(plot.background = element_rect(color = "black")), # time plot_grid(metrics_plots[[2]], metrics_plots[[3]], ncol = 2, rel_widths =c(3, 3)) + theme(plot.background = element_rect(color = "#999999")), # ERROR plot_grid(metrics_plots[[4]], metrics_plots[[5]], 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[[v]] <-this_grid } final_grid <- plot_grid(plots[[1]], plots[[2]], plots[[3]], # config ncol = 3 ) margin = theme(plot.margin = unit(c(2,2,2,2), "cm")) filename <- "plots/all_tasks_mapSize/time_error_all_tasks_per_phase.pdf" ggsave(filename = filename, final_grid, device = "pdf", width=18, height=4)