From d9000cf816c96ec261b8efd45f2b1ddecb6bcbb3 Mon Sep 17 00:00:00 2001 From: JakeConway Date: Tue, 29 Nov 2016 14:42:57 -0500 Subject: [PATCH] update log2 and log10 axis and bar labels --- R/MainBar.R | 8 ++++++++ R/SizeBar.R | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/R/MainBar.R b/R/MainBar.R index 2d5bb94..f0446e6 100644 --- a/R/MainBar.R +++ b/R/MainBar.R @@ -107,6 +107,14 @@ Make_main_bar <- function(Main_bar_data, Q, show_num, ratios, customQ, number_an if(ylabel == "Intersection Size" && scale_intersections != "identity"){ ylabel <- paste("Intersection Size", paste0("( ", scale_intersections, " )")) + if(scale_intersections == "log2"){ + Main_bar_data$freq <- round(log2(Main_bar_data$freq)) + ymax <- log2(ymax) + } + if(scale_intersections == "log10"){ + Main_bar_data$freq <- round(log10(Main_bar_data$freq)) + ymax <- log10(ymax) + } } Main_bar_plot <- (ggplot(data = Main_bar_data, aes_string(x = "x", y = "freq")) diff --git a/R/SizeBar.R b/R/SizeBar.R index e4d0d63..9e96023 100644 --- a/R/SizeBar.R +++ b/R/SizeBar.R @@ -54,6 +54,12 @@ Make_size_plot <- function(Set_size_data, sbar_color, ratios, ylabel, scale_sets if(ylabel == "Set Size" && scale_sets != "identity"){ ylabel <- paste("Set Size", paste0("( ", scale_sets, " )")) + if(scale_sets == "log2"){ + Set_size_data$y <- log2(Set_size_data$y) + } + if(scale_sets == "log10"){ + Set_size_data$y <- log10(Set_size_data$y) + } } Size_plot <- (ggplot(data = Set_size_data, aes_string(x ="x", y = "y")) @@ -66,7 +72,7 @@ Make_size_plot <- function(Set_size_data, sbar_color, ratios, ylabel, scale_sets plot.margin=unit(c(-0.11,-1.3,0.5,0.5), "lines"), axis.title.x = element_text(size = 8.3*x_axis_title_scale), axis.text.x = element_text(size = 7*x_axis_tick_label_scale, angle = set_size_angle, - vjust = 1, hjust = 1), + vjust = 1, hjust = 0.5), axis.line = element_line(colour = "gray0"), axis.line.y = element_blank(), axis.line.x = element_line(colour = "gray0", size = 0.3),