Commit 230eda81 authored by Stanley Clark's avatar Stanley Clark
Browse files

New analysis graphs

parent 6e99bc7e
if (!require("pacman"))
install.packages("pacman")
pacman::p_load(stringr, ggplot2, reshape2, tikzDevice, R.devices, gridExtra)
pacman::p_load(plyr, ggallin, formattable, grid, gtable, tidyverse)
pacman::p_load(plyr, ggallin, formattable, grid, gtable, tidyverse,extrafont)
options(tz = "Europe/Amsterdam")
font_import(pattern="[L/l]ibertine")
source("stats.R")
source("plots.R")
......@@ -17,8 +19,11 @@ results <- rbind(
# All queries
stats <- get_stats(results)
diff_plan <- diff_plan_time()
stacked <- stacked_means()
grid.arrange(stacked_means())
grid.arrange(diff_plan_time())
grid.arrange(box_db_query_absolute_log(1))
grid.arrange(box_db_query_relative(1))
abs1 <- box_db_query_absolute_log(1)
abs2 <- box_db_query_absolute_log(2)
abs5 <- box_db_query_absolute_log(5)
......@@ -27,19 +32,14 @@ rel1 <- box_db_query_relative(1)
rel2 <- box_db_query_relative(2)
rel5 <- box_db_query_relative(5)
rel10 <- box_db_query_relative(10)
grid.arrange(stacked_means())
grid.arrange(diff_plan)
grid.arrange(abs1, abs2, abs5, abs10, rel1, rel2, rel5, rel10, nrow = 2)
save_to_tex("stacked_means.tex", stacked_means(), 3, 1.5)
save_to_tex("planning_time_joins.tex", diff_plan_time(), 2.2, 1.6)
save_to_tex("diff_execution_time_log.tex", box_db_query_absolute_log(1), 2.2, 1.6)
save_to_tex("rel_diff_execution_time.tex", box_db_query_relative(1), 2.2, 1.6)
save_to_tex("stacked_means.tex", stacked_means(), 2.75, 1.4)
save_to_tex("planning_time_joins.tex", diff_plan_time(), 2.75, 1.5)
for (i in c(1, 2, 5, 10)) {
diff_name <- paste("diff_execution_time_log-", i, ".tex", sep = "")
rel_name <- paste("rel_diff_execution_time-", i, ".tex", sep = "")
save_to_tex(diff_name, box_db_query_absolute_log(i), 2.2, 1.6)
save_to_tex(rel_name, box_db_query_relative(i), 2.2, 1.6)
save_to_tex(diff_name, box_db_query_absolute_log(i), 1.8, 1.4)
save_to_tex(rel_name, box_db_query_relative(i), 1.8, 1.4)
}
This diff is collapsed.
% Created by tikzDevice version 0.12.3.1 on 2021-01-28 10:00:44
% Created by tikzDevice version 0.12.3.1 on 2021-03-23 11:26:19
% !TEX encoding = UTF-8 Unicode
\begin{tikzpicture}[x=1pt,y=1pt]
\definecolor{fillColor}{RGB}{255,255,255}
\path[use as bounding box,fill=fillColor,fill opacity=0.00] (0,0) rectangle (158.99,115.63);
\path[use as bounding box,fill=fillColor,fill opacity=0.00] (0,0) rectangle (198.74,108.41);
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{RGB}{255,255,255}
\definecolor{fillColor}{RGB}{255,255,255}
\path[draw=drawColor,line width= 0.6pt,line join=round,line cap=round,fill=fillColor] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[draw=drawColor,line width= 0.6pt,line join=round,line cap=round,fill=fillColor] ( 0.00, 0.00) rectangle (198.74,108.41);
\end{scope}
\begin{scope}
\path[clip] ( 33.06, 25.92) rectangle (153.49,107.09);
\path[clip] ( 26.86, 21.94) rectangle (193.24, 99.86);
\definecolor{fillColor}{RGB}{255,255,255}
\path[fill=fillColor] ( 33.06, 25.92) rectangle (153.49,107.09);
\path[fill=fillColor] ( 26.86, 21.94) rectangle (193.24, 99.86);
\definecolor{drawColor}{gray}{0.92}
\path[draw=drawColor,line width= 0.3pt,line join=round] ( 33.06, 36.37) --
(153.49, 36.37);
\path[draw=drawColor,line width= 0.3pt,line join=round] ( 26.86, 31.98) --
(193.24, 31.98);
\path[draw=drawColor,line width= 0.3pt,line join=round] ( 33.06, 56.06) --
(153.49, 56.06);
\path[draw=drawColor,line width= 0.3pt,line join=round] ( 26.86, 50.88) --
(193.24, 50.88);
\path[draw=drawColor,line width= 0.3pt,line join=round] ( 33.06, 75.75) --
(153.49, 75.75);
\path[draw=drawColor,line width= 0.3pt,line join=round] ( 26.86, 69.78) --
(193.24, 69.78);
\path[draw=drawColor,line width= 0.3pt,line join=round] ( 33.06, 95.45) --
(153.49, 95.45);
\path[draw=drawColor,line width= 0.3pt,line join=round] ( 26.86, 88.69) --
(193.24, 88.69);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 33.06, 26.52) --
(153.49, 26.52);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 26.86, 22.53) --
(193.24, 22.53);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 33.06, 46.22) --
(153.49, 46.22);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 26.86, 41.43) --
(193.24, 41.43);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 33.06, 65.91) --
(153.49, 65.91);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 26.86, 60.33) --
(193.24, 60.33);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 33.06, 85.60) --
(153.49, 85.60);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 26.86, 79.23) --
(193.24, 79.23);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 33.06,105.29) --
(153.49,105.29);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 26.86, 98.14) --
(193.24, 98.14);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 46.96, 25.92) --
( 46.96,107.09);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 46.05, 21.94) --
( 46.05, 99.86);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 70.12, 25.92) --
( 70.12,107.09);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 78.05, 21.94) --
( 78.05, 99.86);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 93.28, 25.92) --
( 93.28,107.09);
\path[draw=drawColor,line width= 0.6pt,line join=round] (110.05, 21.94) --
(110.05, 99.86);
\path[draw=drawColor,line width= 0.6pt,line join=round] (116.44, 25.92) --
(116.44,107.09);
\path[draw=drawColor,line width= 0.6pt,line join=round] (142.05, 21.94) --
(142.05, 99.86);
\path[draw=drawColor,line width= 0.6pt,line join=round] (139.60, 25.92) --
(139.60,107.09);
\path[draw=drawColor,line width= 0.6pt,line join=round] (174.04, 21.94) --
(174.04, 99.86);
\definecolor{drawColor}{RGB}{0,0,0}
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 46.96, 30.06) --
( 70.12, 29.61) --
( 93.28, 41.00) --
(116.44, 63.66) --
(139.60,100.79);
\path[draw=drawColor,line width= 0.6pt,dash pattern=on 2pt off 2pt ,line join=round] ( 46.96, 30.84) --
( 70.12, 30.44) --
( 93.28, 42.56) --
(116.44, 65.14) --
(139.60,103.40);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 46.05, 25.92) --
( 78.05, 25.48) --
(110.05, 36.42) --
(142.05, 58.17) --
(174.04, 93.81);
\path[draw=drawColor,line width= 0.6pt,dash pattern=on 2pt off 2pt ,line join=round] ( 46.05, 26.67) --
( 78.05, 26.29) --
(110.05, 37.92) --
(142.05, 59.59) --
(174.04, 96.32);
\definecolor{drawColor}{gray}{0.20}
\path[draw=drawColor,line width= 0.6pt,line join=round,line cap=round] ( 33.06, 25.92) rectangle (153.49,107.09);
\path[draw=drawColor,line width= 0.6pt,line join=round,line cap=round] ( 26.86, 21.94) rectangle (193.24, 99.86);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{gray}{0.30}
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 28.11, 24.32) {0};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.44] at ( 21.91, 21.01) {0};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 28.11, 44.01) {500};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.44] at ( 21.91, 39.91) {500};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 28.11, 63.70) {1000};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.44] at ( 21.91, 58.82) {1000};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 28.11, 83.40) {1500};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.44] at ( 21.91, 77.72) {1500};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 28.11,103.09) {2000};
\node[text=drawColor,anchor=base east,inner sep=0pt, outer sep=0pt, scale= 0.44] at ( 21.91, 96.62) {2000};
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{gray}{0.20}
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 30.31, 26.52) --
( 33.06, 26.52);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 24.11, 22.53) --
( 26.86, 22.53);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 30.31, 46.22) --
( 33.06, 46.22);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 24.11, 41.43) --
( 26.86, 41.43);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 30.31, 65.91) --
( 33.06, 65.91);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 24.11, 60.33) --
( 26.86, 60.33);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 30.31, 85.60) --
( 33.06, 85.60);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 24.11, 79.23) --
( 26.86, 79.23);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 30.31,105.29) --
( 33.06,105.29);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 24.11, 98.14) --
( 26.86, 98.14);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{gray}{0.20}
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 46.96, 23.17) --
( 46.96, 25.92);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 46.05, 19.19) --
( 46.05, 21.94);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 70.12, 23.17) --
( 70.12, 25.92);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 78.05, 19.19) --
( 78.05, 21.94);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 93.28, 23.17) --
( 93.28, 25.92);
\path[draw=drawColor,line width= 0.6pt,line join=round] (110.05, 19.19) --
(110.05, 21.94);
\path[draw=drawColor,line width= 0.6pt,line join=round] (116.44, 23.17) --
(116.44, 25.92);
\path[draw=drawColor,line width= 0.6pt,line join=round] (142.05, 19.19) --
(142.05, 21.94);
\path[draw=drawColor,line width= 0.6pt,line join=round] (139.60, 23.17) --
(139.60, 25.92);
\path[draw=drawColor,line width= 0.6pt,line join=round] (174.04, 19.19) --
(174.04, 21.94);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{gray}{0.30}
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 46.96, 16.56) {2};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.44] at ( 46.05, 13.96) {2};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 70.12, 16.56) {3};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.44] at ( 78.05, 13.96) {3};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 93.28, 16.56) {4};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.44] at (110.05, 13.96) {4};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.64] at (116.44, 16.56) {5};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.44] at (142.05, 13.96) {5};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.64] at (139.60, 16.56) {7};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.44] at (174.04, 13.96) {7};
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{RGB}{0,0,0}
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.80] at ( 93.28, 7.06) {Number of joins};
\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.55] at (110.05, 6.57) {Number of joins};
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{RGB}{0,0,0}
\node[text=drawColor,rotate= 90.00,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.80] at ( 11.01, 66.50) {Absolute planning time (ms)};
\node[text=drawColor,rotate= 90.00,anchor=base,inner sep=0pt, outer sep=0pt, scale= 0.55] at ( 9.29, 60.90) {Absolute planning time (ms)};
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{fillColor}{RGB}{255,255,255}
\path[fill=fillColor] ( 39.95,108.09) rectangle (146.61,120.13);
\path[fill=fillColor] ( 69.62,100.86) rectangle (150.48,112.91);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{RGB}{0,0,0}
\node[text=drawColor,anchor=base west,inner sep=0pt, outer sep=0pt, scale= 0.80] at ( 39.95,111.35) {Variant};
\node[text=drawColor,anchor=base west,inner sep=0pt, outer sep=0pt, scale= 0.55] at ( 69.62,104.99) {Variant};
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{fillColor}{RGB}{255,255,255}
\path[fill=fillColor] ( 69.96,108.09) rectangle ( 82.01,120.13);
\path[fill=fillColor] ( 90.25,100.86) rectangle (102.30,112.91);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{RGB}{0,0,0}
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 71.17,114.11) -- ( 80.80,114.11);
\path[draw=drawColor,line width= 0.6pt,line join=round] ( 91.46,106.88) -- (101.10,106.88);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{fillColor}{RGB}{255,255,255}
\path[fill=fillColor] (110.71,108.09) rectangle (122.76,120.13);
\path[fill=fillColor] (122.04,100.86) rectangle (134.08,112.91);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{RGB}{0,0,0}
\path[draw=drawColor,line width= 0.6pt,dash pattern=on 2pt off 2pt ,line join=round] (111.92,114.11) -- (121.55,114.11);
\path[draw=drawColor,line width= 0.6pt,dash pattern=on 2pt off 2pt ,line join=round] (123.24,106.88) -- (132.88,106.88);
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{RGB}{0,0,0}
\node[text=drawColor,anchor=base west,inner sep=0pt, outer sep=0pt, scale= 0.64] at ( 86.01,111.91) {Default};
\node[text=drawColor,anchor=base west,inner sep=0pt, outer sep=0pt, scale= 0.44] at (105.05,105.37) {Default};
\end{scope}
\begin{scope}
\path[clip] ( 0.00, 0.00) rectangle (158.99,115.63);
\path[clip] ( 0.00, 0.00) rectangle (198.74,108.41);
\definecolor{drawColor}{RGB}{0,0,0}
\node[text=drawColor,anchor=base west,inner sep=0pt, outer sep=0pt, scale= 0.64] at (126.76,111.91) {sec-RA};
\node[text=drawColor,anchor=base west,inner sep=0pt, outer sep=0pt, scale= 0.44] at (136.83,105.37) {sec-RA};
\end{scope}
\end{tikzpicture}
This diff is collapsed.
This diff is collapsed.
ggplot_theme <- theme_bw() + theme(
text = element_text(size=8),
text = element_text(size=5.5),
axis.text.x = element_text(angle = 0),
legend.position="top",
legend.key.size = unit(1,"line")
......@@ -40,9 +40,8 @@ box_db_query_absolute_log <- function(scale) {
scale_x_continuous(trans = pseudolog10_trans, labels = k_format) +
geom_vline(xintercept = 0, linetype = "dotted") +
labs(y = "Query", x = "Execution time (1000's of ms)", fill = "Variant") +
scale_fill_discrete(labels = ggplot_case_labels) +
theme(axis.text.x = element_text(angle = 90)) +
scale_fill_brewer(palette="PuOr")
scale_fill_brewer(labels = ggplot_case_labels, palette="YlGnBu")
}
# 3. Box plot of relative increases in DB execution time
......@@ -52,8 +51,8 @@ box_db_query_relative <- function(scale) {
ggplot_theme +
geom_vline(xintercept = 0, linetype = "dotted") +
scale_x_continuous(labels = latex_percent) +
labs(y = "Query", x = "Relative improvement in execution time (\\%)") +
scale_fill_discrete(labels = ggplot_case_labels)
labs(y = "Query", x = "Execution time improvement (\\%)") +
scale_fill_brewer(palette="Dark2")
}
# 4. Stacked plot of mean value of all components
......@@ -69,14 +68,14 @@ stacked_means <- function() {
ggplot_theme +
labs(x = "Variant", y = "Time (ms)", fill = "Component") +
scale_x_discrete(labels = ggplot_case_labels) +
scale_fill_discrete(labels = c("Combine", "Planning", "DB")) +
theme(legend.position="right", axis.text.x = element_text(angle = 0,vjust = 0.7),legend.margin=margin(0,0,0,0),
legend.box.margin=margin(0,0,0,-8), strip.text.x = element_text(size = 6,margin = margin(.01, 0, .01, 0, "cm")))
scale_fill_brewer(labels = c("Combine", "Planning", "DB"), type = "seq", palette = "YlGnBu") +
theme(legend.position="right", axis.text.x = element_text(angle = 315,vjust = 0.7),legend.margin=margin(0,0,0,0),
legend.box.margin=margin(0,0,0,-8), strip.text.x = element_text(margin = margin(.01, 0, .01, 0, "cm")))
# Add general facet scale label
z <- ggplotGrob(p)
z <- gtable_add_rows(z, unit(1, "line"), 1)
z <- gtable_add_grob(z, textGrob("Scale Factor", gp=gpar(fontsize=7)), 1, 5, 1, 10)
z <- gtable_add_grob(z, textGrob("Scale Factor", gp=gpar(fontsize=5.5)), 1, 5, 1, 10)
z$heights[c(2)] = unit(.1, "cm")
return(z)
}
......@@ -159,11 +158,7 @@ bar_diff_plan_time <- function() {
scale_fill_discrete(labels = ggplot_case_labels)
}
# -------- To Tex functions --------
save_third <- function(filename, plot) {
save_to_tex(filename, plot, width = 2.1, height = 2.1)
}
# -------- To Tex function --------
save_to_tex <- function(filename, plot, width, height) {
tikz(file = file.path("output", filename), width = width, height = height)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment