From 7256db77fb8cb6b66adfdb755b5d8b193f931f79 Mon Sep 17 00:00:00 2001
From: eeenilsson <20885220+eeenilsson@users.noreply.github.com>
Date: Wed, 28 Apr 2021 19:06:35 +0200
Subject: [PATCH 1/3] Update Boxplot.R

Fixes error and misalignment of boxplots by adding factor() around plot_lims
---
 R/Boxplot.R | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/R/Boxplot.R b/R/Boxplot.R
index 3939e25..1c308d1 100644
--- a/R/Boxplot.R
+++ b/R/Boxplot.R
@@ -2,7 +2,6 @@
 IntersectionBoxPlot <- function(data1, data2, start_col, names){
   end_col <- ((start_col + length(names)) - 1)
   data2 <- data2[which(rowSums(data2[ ,start_col:end_col]) != 0), ]
-  #tagging because x axis values need to be 1:number of sets so they line up with their intersections
   data2$tag <- 1:nrow(data2)
   sets <- list()
   intersections <- list()
@@ -42,7 +41,7 @@ BoxPlotsPlot <- function(bdat, att, att_color){
   bdat$x <- as.factor(bdat$x)
   boxplots <- ggplotGrob(ggplot()
                          + theme_bw() +ylab(yaxis)
-                         + scale_x_discrete(limits = plot_lims, expand = c(0,0))
+                         + scale_x_discrete(limits = factor(plot_lims), expand = c(0,0))
                          + theme(plot.margin = unit(c(-0.7,0,0,0), "cm"),
                                  axis.title.y = element_text(vjust = -0.8),
                                  axis.ticks.x = element_blank(),
@@ -54,4 +53,4 @@ BoxPlotsPlot <- function(bdat, att, att_color){
                          + geom_boxplot(data = bdat, aes_string(x="x", y="attribute"),
                                         fill = att_color, colour = "gray80"))
   return(boxplots)
-}
\ No newline at end of file
+}

From 6c6a930de7aa236ee9644f527ebe5e3b9f472d09 Mon Sep 17 00:00:00 2001
From: Erik Nilsson <eeenilsson@users.noreply.github.com>
Date: Sun, 16 Apr 2023 03:23:51 +0200
Subject: [PATCH 2/3] blac colored lines for boxplots

---
 R/Boxplot.R | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/R/Boxplot.R b/R/Boxplot.R
index 1c308d1..256b9c8 100644
--- a/R/Boxplot.R
+++ b/R/Boxplot.R
@@ -51,6 +51,6 @@ BoxPlotsPlot <- function(bdat, att, att_color){
                                  panel.grid.major = element_blank(),
                                  axis.title.x = element_blank())
                          + geom_boxplot(data = bdat, aes_string(x="x", y="attribute"),
-                                        fill = att_color, colour = "gray80"))
+                                        fill = att_color, colour = "black", outlier.size = 0.3))
   return(boxplots)
 }

From 1d6d580d331119b2bec48c1eed0e8d9308f3bf8e Mon Sep 17 00:00:00 2001
From: Erik Nilsson <eeenilsson@users.noreply.github.com>
Date: Mon, 24 Apr 2023 18:17:52 +0200
Subject: [PATCH 3/3] added notches and horizontal line at median for boxplots

---
 R/Boxplot.R | 10 ++++++++--
 R/MainBar.R |  4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/R/Boxplot.R b/R/Boxplot.R
index 256b9c8..71a2bd1 100644
--- a/R/Boxplot.R
+++ b/R/Boxplot.R
@@ -43,7 +43,7 @@ BoxPlotsPlot <- function(bdat, att, att_color){
                          + theme_bw() +ylab(yaxis)
                          + scale_x_discrete(limits = factor(plot_lims), expand = c(0,0))
                          + theme(plot.margin = unit(c(-0.7,0,0,0), "cm"),
-                                 axis.title.y = element_text(vjust = -0.8),
+                                 axis.title.y = element_text(vjust = -0.6, size = 10),
                                  axis.ticks.x = element_blank(),
                                  axis.text.x = element_blank(),
                                  panel.border = element_blank(),
@@ -51,6 +51,12 @@ BoxPlotsPlot <- function(bdat, att, att_color){
                                  panel.grid.major = element_blank(),
                                  axis.title.x = element_blank())
                          + geom_boxplot(data = bdat, aes_string(x="x", y="attribute"),
-                                        fill = att_color, colour = "black", outlier.size = 0.3))
+                                        fill = att_color, colour = "gray43",
+                                        outlier.size = 0.3
+                                        , notch = TRUE
+                                        )
+                         + geom_hline(aes(yintercept = median(bdat$attribute, na.rm = TRUE)), alpha = 0.3)
+                         
+                         )
   return(boxplots)
 }
diff --git a/R/MainBar.R b/R/MainBar.R
index e9cf791..ae1e2e4 100644
--- a/R/MainBar.R
+++ b/R/MainBar.R
@@ -125,8 +125,8 @@ Make_main_bar <- function(Main_bar_data, Q, show_num, ratios, customQ, number_an
                     + xlab(NULL) + ylab(ylabel) +labs(title = NULL)
                     + theme(panel.background = element_rect(fill = "white"),
                             plot.margin = unit(c(0.5,0.5,bottom_margin,0.5), "lines"), panel.border = element_blank(),
-                            axis.title.y = element_text(vjust = -0.8, size = 8.3*y_axis_title_scale), axis.text.y = element_text(vjust=0.3,
-                                                                                                            size=7*y_axis_tick_label_scale)))
+                            axis.title.y = element_text(vjust = -0.8, size = 10*y_axis_title_scale), axis.text.y = element_text(vjust=0.3,
+                                                                                                            size=10*y_axis_tick_label_scale)))
   if((show_num == "yes") || (show_num == "Yes")){
     if(is.null(number.colors)) {
       Main_bar_plot <- (Main_bar_plot + geom_text(aes_string(label = "freq"), size = 2.2*intersection_size_number_scale, vjust = -1,