From 3ee8b946b817e7363e9665d290d7077ae777b5c9 Mon Sep 17 00:00:00 2001 From: rpalaganas Date: Thu, 28 Mar 2024 12:25:21 -0400 Subject: [PATCH 1/2] Plotting updates Fixed small bug where plots would not display due to cowplot::get_legend() returning many components. Resolved ggplot2 warnings printed to console due to use of `stats$label` rather than `label` --- R/plotting.R | 2 +- R/projectionDriveRfun.R | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/R/plotting.R b/R/plotting.R index 31bbfe4..3f44a59 100644 --- a/R/plotting.R +++ b/R/plotting.R @@ -170,7 +170,7 @@ plotVolcano <- function( volcano <- ggplot(data = stats, aes(x = mean_diff, y = -log10(welch_padj), color = Color, - label = stats$label)) + + label = label)) + geom_vline(xintercept = c(FC, -FC), lty = "dashed") + geom_hline(yintercept = -log10(pvalue), lty = "dashed") + geom_point(na.rm = TRUE) + diff --git a/R/projectionDriveRfun.R b/R/projectionDriveRfun.R index 91dd4e2..3776320 100644 --- a/R/projectionDriveRfun.R +++ b/R/projectionDriveRfun.R @@ -340,9 +340,7 @@ projectionDriveR <- function( result$plt$weighted_differential_expression + theme(legend.position = "none"), ncol = 2L, align = "h") - legend <- cowplot::get_legend(result$plt$differential_expression + - guides(color = guide_legend(nrow = 1L)) + - theme(legend.position = "bottom")) + legend <- cowplot::get_plot_component(result$plt$differential_expression, "guide-box-bottom") plt <- cowplot::plot_grid(pltgrid, legend, ncol = 1L, rel_heights = c(1.0, 0.1)) print(plt) } From 7433cff5d41dcf5a1008d034949357cebba28957 Mon Sep 17 00:00:00 2001 From: rpalaganas Date: Thu, 28 Mar 2024 12:31:46 -0400 Subject: [PATCH 2/2] Update plotting.R --- R/plotting.R | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/R/plotting.R b/R/plotting.R index 3f44a59..66f112c 100644 --- a/R/plotting.R +++ b/R/plotting.R @@ -355,9 +355,7 @@ pdVolcano <- function( vol_result$plt$weighted_differential_expression + theme(legend.position = "none"), ncol = 2L, align = "h") - legend <- cowplot::get_legend(vol_result$plt$differential_expression + - guides(color = guide_legend(nrow = 1L)) + - theme(legend.position = "bottom")) + legend <- cowplot::get_plot_component(result$plt$differential_expression, "guide-box-bottom") plt <- cowplot::plot_grid(pltgrid, legend, ncol = 1L,