From 7fceb96a839113e94d4c0ad612b686c36317957f Mon Sep 17 00:00:00 2001 From: Andreas Gammelgaard Damsbo Date: Fri, 8 Aug 2025 11:49:18 +0200 Subject: [PATCH] version bump --- DESCRIPTION | 2 +- NEWS.md | 7 ++++++- inst/apps/FreesearchR/app.R | 42 ++++++++++++++++++++++++------------- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 90d672e..7276ef6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: FreesearchR Title: A free and open-source browser based data analysis tool for researchers with publication ready output -Version: 25.7.3 +Version: 25.8.1 Authors@R: c( person("Andreas Gammelgaard", "Damsbo",email="agdamsbo@clin.au.dk", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7559-1154")), diff --git a/NEWS.md b/NEWS.md index 04658d4..fa4f823 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,12 @@ -# FreesearchR 25.7.3 - DEV +# FreesearchR 25.8.2 - DEV - *NEW* preparing to automatically only show relevant tabs to simplify interface. NOT IMPLEMENTED YET +# FreesearchR 25.8.1 + +- *NEW* improved the use of `wrap_plot_list()` to pass on additional arguments to `patchwork::wrap_plots()` and allowed to specify axes to align in `align_axes()`. +- *FIX* fixed axis text printed in Euler diagrams + # FreesearchR 25.7.2 - *FIX* refining hiding drop downs. All JavaScript is now in separate file. Coded with GAI help from claude.ai. diff --git a/inst/apps/FreesearchR/app.R b/inst/apps/FreesearchR/app.R index 4ec133e..8d19c83 100644 --- a/inst/apps/FreesearchR/app.R +++ b/inst/apps/FreesearchR/app.R @@ -2364,7 +2364,8 @@ wrap_plot_list <- function(data, patchwork::wrap_plots( guides = "collect", axes = "collect", - axis_titles = "collect" + axis_titles = "collect", + ... ) if (!is.null(tag_levels)) { out <- out + patchwork::plot_annotation(tag_levels = tag_levels) @@ -2400,7 +2401,7 @@ wrap_plot_list <- function(data, #' @returns list of ggplot2 objects #' @export #' -align_axes <- function(...) { +align_axes <- function(...,x.axis=TRUE,y.axis=TRUE) { # https://stackoverflow.com/questions/62818776/get-axis-limits-from-ggplot-object # https://github.com/thomasp85/patchwork/blob/main/R/plot_multipage.R#L150 if (ggplot2::is_ggplot(..1)) { @@ -2418,7 +2419,16 @@ align_axes <- function(...) { xr <- clean_common_axis(p, "x") suppressWarnings({ - p |> purrr::map(~ .x + ggplot2::xlim(xr) + ggplot2::ylim(yr)) + purrr::map(p, \(.x){ + out <- .x + if (isTRUE(x.axis)){ + out <- out + ggplot2::xlim(xr) + } + if (isTRUE(y.axis)){ + out <- out + ggplot2::ylim(yr) + } + out + }) }) } @@ -5029,7 +5039,7 @@ plot_euler <- function(data, pri, sec, ter = NULL, seed = 2103) { na.omit() |> plot_euler_single() }) - +# browser() # names(out) wrap_plot_list(out,title=glue::glue("Grouped by {get_label(data,ter)}")) # patchwork::wrap_plots(out, guides = "collect") @@ -5087,6 +5097,7 @@ plot_euler_single <- function(data) { #' #' @examples #' mtcars |> plot_hbars(pri = "carb", sec = "cyl") +#' mtcars |> plot_hbars(pri = "carb", sec = "cyl", ter="am") #' mtcars |> plot_hbars(pri = "carb", sec = NULL) plot_hbars <- function(data, pri, sec, ter = NULL) { out <- vertical_stacked_bars(data = data, score = pri, group = sec, strata = ter) @@ -5496,17 +5507,20 @@ plot_violin <- function(data, pri, sec, ter = NULL) { ds <- list(data) } - out <- lapply(ds, \(.ds){ - rempsyc::nice_violin( - data = .ds, - group = sec, - response = pri, - xtitle = get_label(data, var = sec), - ytitle = get_label(data, var = pri) - ) - }) + # browser() + suppressWarnings({ + out <- lapply(ds, \(.ds){ + rempsyc::nice_violin( + data = .ds, + group = sec, + response = pri, + xtitle = get_label(data, var = sec), + ytitle = get_label(data, var = pri) + ) + }) - wrap_plot_list(out,title=glue::glue("Grouped by {get_label(data,ter)}")) + wrap_plot_list(out, title = glue::glue("Grouped by {get_label(data,ter)}")) + }) # patchwork::wrap_plots(out,guides = "collect") }