From 0b67419f6f8959fc9fc95087c6918a77090e3237 Mon Sep 17 00:00:00 2001 From: Jonas Hagenberg <38041374+jonas-hag@users.noreply.github.com> Date: Sun, 12 Mar 2023 16:28:19 +0100 Subject: [PATCH] add the ability to determine how many item-consensus plots are plotted in one plot before a new plot is used --- NEWS.md | 2 ++ R/plot.lcc.R | 6 +++++- man/plot.lcc.Rd | 7 +++++-- .../plot_lcc_output_item_consenus_1.png | Bin 0 -> 22476 bytes tests/testthat/test_lcc_plot.R | 11 +++++++++++ 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/_snaps/lcc_plot/plot_lcc_output_item_consenus_1.png diff --git a/NEWS.md b/NEWS.md index 3f3121a..e2f4486 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ * include the argument `which_plots` in the `plot.lcc` function so that one can specify which plots should be plotted +* include the argument `n_item_consensus` in the `plot.lcc` function so that one + can specify how many item consensus plots should be plotted in one plot # longmixr 1.0.0 diff --git a/R/plot.lcc.R b/R/plot.lcc.R index d66f752..287ddc4 100644 --- a/R/plot.lcc.R +++ b/R/plot.lcc.R @@ -9,6 +9,8 @@ #' of clusters, \code{"CDF"}, \code{"delta"}, \code{"cluster_tracking"}, #' \code{"item_consensus"} or \code{"cluster_consensus"}. When you want to plot #' all consensus matrices and the legend, you can just use \code{"consensusmatrix"}. +#' @param n_item_consensus determines how many item consensus plots are plotted +#' together in one plot before a new plot is used; the default is \code{3}. #' @param ... additional parameters for plotting; currently not used #' #' @return Plots the following plots (when selected):\tabular{ll}{ @@ -35,10 +37,12 @@ plot.lcc <- function(x, color_palette = NULL, which_plots = "all", + n_item_consensus = 3, ...) { checkmate::assert_class(x, "lcc") checkmate::assert_character(color_palette, null.ok = TRUE) + checkmate::assert_int(n_item_consensus, lower = 1) # determine the possible consensus matrices possible_consensusmatrix <- paste0("consensusmatrix_", @@ -178,7 +182,7 @@ plot.lcc <- function(x, cci <- rbind() sumx <- list() colors_arr <- c() - old_par <- par(mfrow = c(3, 1), mar = c(4, 3, 2, 0)) + old_par <- par(mfrow = c(n_item_consensus, 1), mar = c(4, 3, 2, 0)) on.exit(par(old_par)) # tk is the number of predefined clusters for (tk in seq(from = 2, to = length(x), by = 1)) { diff --git a/man/plot.lcc.Rd b/man/plot.lcc.Rd index 473f37f..bffa53c 100644 --- a/man/plot.lcc.Rd +++ b/man/plot.lcc.Rd @@ -4,7 +4,7 @@ \alias{plot.lcc} \title{Plot a longitudinal consensus clustering} \usage{ -\method{plot}{lcc}(x, color_palette = NULL, which_plots = "all", ...) +\method{plot}{lcc}(x, color_palette = NULL, which_plots = "all", n_item_consensus = 3, ...) } \arguments{ \item{x}{\code{lcc} object (output from \code{\link{longitudinal_consensus_cluster}})} @@ -13,12 +13,15 @@ \item{which_plots}{determine which plots should be plotted; the default is \code{"all"}. Alternatively, a combination of the following values can be specified to plot -only certain plots of the below mentioned plots: \code{"consensusmatrix_legend"}, +only some of the below mentioned plots: \code{"consensusmatrix_legend"}, \code{"consensusmatrix_x"} where \code{x} is replaced by the corresponding number of clusters, \code{"CDF"}, \code{"delta"}, \code{"cluster_tracking"}, \code{"item_consensus"} or \code{"cluster_consensus"}. When you want to plot all consensus matrices and the legend, you can just use \code{"consensusmatrix"}.} +\item{n_item_consensus}{determines how many item consensus plots are plotted +together in one plot before a new plot is used; the default is \code{3}.} + \item{...}{additional parameters for plotting; currently not used} } \value{ diff --git a/tests/testthat/_snaps/lcc_plot/plot_lcc_output_item_consenus_1.png b/tests/testthat/_snaps/lcc_plot/plot_lcc_output_item_consenus_1.png new file mode 100644 index 0000000000000000000000000000000000000000..1a577bbad7d8acdb1e55034e824ef20c634853c2 GIT binary patch literal 22476 zcmeHvcTiJZw|7895EKNI-b6%1ny7S$pkSpaMMMaQNCzp>Ly;=d1f_^H!3Ic`CM5^~ zln6nkg%*kwrG^>^kh}A|k8zc&7S&TnGSb#{;;w&H|w!k{qq39fwcvF{@#&Esgag4;)A`#xm5xLEYl<4=!L zagWxcd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R index 3b964b3..fc3b917 100644 --- a/tests/testthat/test_lcc_plot.R +++ b/tests/testthat/test_lcc_plot.R @@ -73,3 +73,14 @@ test_that("the which_plots argument is correct", { expect_snapshot_file(save_png(plot(clustering, which_plots = c("CDF", "cluster_tracking"))), "plot_lcc_output_cdf_cluster_tracking.png") }) + +test_that("the n_item_consensus argument is correct", { + expect_error(plot(clustering, n_item_consensus = "test")) + expect_error(plot(clustering, n_item_consensus = -1)) + + skip_on_ci() + # only the last plot (with k=3) is recorded + expect_snapshot_file(save_png(plot(clustering, which_plots = "item_consensus", + n_item_consensus = 1)), + "plot_lcc_output_item_consenus_1.png") +})