From 7f84f161be2e0125e9d7f57ee276b024fa4fb667 Mon Sep 17 00:00:00 2001 From: almeidasilvaf Date: Thu, 15 Feb 2024 18:47:21 +0100 Subject: [PATCH] Remove redundancy in x axis of schematic line plots --- R/utils.R | 5 +++-- R/visualization.R | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/R/utils.R b/R/utils.R index 8820fa2..b782b9b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -288,11 +288,12 @@ partition_lineplots <- function( geom_line(color = palette[x], linewidth = 1) + geom_point(size = 2, color = "gray20") + theme_bw() + - labs(x = "", y = "", subtitle = subtitle) + + labs(x = NULL, y = NULL, subtitle = subtitle) + theme( panel.grid.minor = element_blank(), axis.text.x = element_text(size = 11, face = "bold"), - axis.text.y = element_blank() + axis.text.y = element_blank(), + axis.ticks.y = element_blank() ) + ylim(c(0, 4)) + scale_x_discrete( diff --git a/R/visualization.R b/R/visualization.R index 75b209d..e42fa2f 100644 --- a/R/visualization.R +++ b/R/visualization.R @@ -180,7 +180,7 @@ plot_expression_partitions <- function( #' partition next to explanatory line plots depicting each partition. #' #' @importFrom ggplot2 geom_bar coord_flip scale_x_discrete geom_text -#' scale_y_continuous +#' scale_y_continuous unit #' @export #' @rdname plot_partition_frequencies #' @examples @@ -225,6 +225,13 @@ plot_partition_frequencies <- function( labels = labels ) + np <- ifelse(group_by == "Category", 10, 4) + p_line[seq_len(np)] <- lapply(p_line[seq_len(np)], function(x) { + p <- x + + theme(axis.text.x = element_blank(), axis.ticks.x = element_blank()) + return(p) + }) + # Combine plots ncols <- ifelse(group_by == "Category", 2, 1) p_final <- wrap_plots(