From c7b948c98673a415d108556456a7fbb552703c65 Mon Sep 17 00:00:00 2001 From: ShixiangWang Date: Thu, 26 Aug 2021 15:53:10 +0800 Subject: [PATCH] Impl y_limits option #381 --- NEWS.md | 1 + R/show_sig_profile.R | 8 +++++++- docs/news/index.html | 1 + docs/reference/show_sig_profile.html | 5 +++++ man/show_sig_profile.Rd | 3 +++ .../test-roxytest-testexamples-show_sig_profile.R | 2 +- 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index e7814ead..ecaf2a73 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # sigminer 2.0.5 +- Impl `y_limits` option in `show_sig_profile()` (#381). - Added function `get_pLOH_score()` for representing the genome that displayed LOH. - Added function `read_copynumber_ascat()` for reading ASCAT result ASCAT object in `.rds` format. - Added function `get_intersect_size()` for getting overlap size between intervals. diff --git a/R/show_sig_profile.R b/R/show_sig_profile.R index 1f6c4d5f..2d11bd0f 100644 --- a/R/show_sig_profile.R +++ b/R/show_sig_profile.R @@ -44,6 +44,7 @@ #' @param x_label_hjust font hjust for x label. #' @param x_lab x axis lab. #' @param y_lab y axis lab. +#' @param y_limits limits to expand in y axis. e.g., `0.2`, `c(0, 0.3)`. #' @param params params `data.frame` of components, obtained from [sig_tally]. #' @param show_cv default is `FALSE`, if `TRUE`, show coefficient of variation when #' `params` is not `NULL`. @@ -124,6 +125,7 @@ show_sig_profile <- function(Signature, x_label_hjust = 1, x_lab = "Components", y_lab = "auto", + y_limits = NULL, params = NULL, show_cv = FALSE, params_label_size = 3, params_label_angle = 60, y_expand = 1, @@ -576,6 +578,10 @@ show_sig_profile <- function(Signature, } } + if (!is.null(y_limits)) { + p <- p + expand_limits(y = y_limits) + } + p <- p + facet_grid(class ~ base, scales = "free", space = free_space) p <- p + scale_y_continuous( @@ -668,7 +674,7 @@ show_sig_profile <- function(Signature, # <<<<<<<<<<<<<<<<< Setting theme p <- p + - guides(fill = FALSE) + .theme_ss + guides(fill = "none") + .theme_ss if (all(mode == "copynumber", !is.null(params))) { p <- p + theme(plot.margin = margin(30 * y_expand, 2, 2, 2, unit = "pt")) # Add regions diff --git a/docs/news/index.html b/docs/news/index.html index b04809f8..60d72125 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -130,6 +130,7 @@

sigminer 2.0.5 Unreleased