From 62b5d7a6682167b34e928b598053184b7c48b0ef Mon Sep 17 00:00:00 2001 From: Andreas Gammelgaard Damsbo Date: Fri, 8 Aug 2025 11:49:09 +0200 Subject: [PATCH] fefat: fixed Euler plotting without axis text --- R/plot_euler.R | 10 +++++----- R/plot_hbar.R | 1 + man/data-plots.Rd | 1 + man/plot_euler.Rd | 1 + man/wrap_plot_list.Rd | 11 ++++++++++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/R/plot_euler.R b/R/plot_euler.R index fc84049..e1e48aa 100644 --- a/R/plot_euler.R +++ b/R/plot_euler.R @@ -76,6 +76,7 @@ ggeulerr <- function( #' D = sample(c(TRUE, FALSE, FALSE, FALSE), 50, TRUE) #' ) |> plot_euler("A", c("B", "C"), "D", seed = 4) #' mtcars |> plot_euler("vs", "am", seed = 1) +#' mtcars |> plot_euler("vs", "am", "cyl", seed = 1) plot_euler <- function(data, pri, sec, ter = NULL, seed = 2103) { set.seed(seed = seed) if (!is.null(ter)) { @@ -90,10 +91,9 @@ plot_euler <- function(data, pri, sec, ter = NULL, seed = 2103) { na.omit() |> plot_euler_single() }) - - # names(out) +# browser() wrap_plot_list(out,title=glue::glue("Grouped by {get_label(data,ter)}")) - # patchwork::wrap_plots(out, guides = "collect") + # patchwork::wrap_plots(out) } #' Easily plot single euler diagrams @@ -123,8 +123,8 @@ plot_euler_single <- function(data) { legend.position = "none", # panel.grid.major = element_blank(), # panel.grid.minor = element_blank(), - # axis.text.y = element_blank(), - # axis.title.y = element_blank(), + axis.text.y = ggplot2::element_blank(), + axis.title.y = ggplot2::element_blank(), text = ggplot2::element_text(size = 20), axis.text = ggplot2::element_blank(), # plot.title = element_blank(), diff --git a/R/plot_hbar.R b/R/plot_hbar.R index deac70c..5e13a8e 100644 --- a/R/plot_hbar.R +++ b/R/plot_hbar.R @@ -7,6 +7,7 @@ #' #' @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) diff --git a/man/data-plots.Rd b/man/data-plots.Rd index 9a612c1..cf0cfff 100644 --- a/man/data-plots.Rd +++ b/man/data-plots.Rd @@ -111,6 +111,7 @@ mtcars |> plot_box_single("mpg") mtcars |> plot_box_single("mpg","cyl") gtsummary::trial |> plot_box_single("age","trt") mtcars |> plot_hbars(pri = "carb", sec = "cyl") +mtcars |> plot_hbars(pri = "carb", sec = "cyl", ter="am") mtcars |> plot_hbars(pri = "carb", sec = NULL) mtcars |> default_parsing() |> diff --git a/man/plot_euler.Rd b/man/plot_euler.Rd index 2785047..b4bc1b2 100644 --- a/man/plot_euler.Rd +++ b/man/plot_euler.Rd @@ -31,4 +31,5 @@ data.frame( D = sample(c(TRUE, FALSE, FALSE, FALSE), 50, TRUE) ) |> plot_euler("A", c("B", "C"), "D", seed = 4) mtcars |> plot_euler("vs", "am", seed = 1) +mtcars |> plot_euler("vs", "am", "cyl", seed = 1) } diff --git a/man/wrap_plot_list.Rd b/man/wrap_plot_list.Rd index bc291df..2a6e8d6 100644 --- a/man/wrap_plot_list.Rd +++ b/man/wrap_plot_list.Rd @@ -9,6 +9,9 @@ wrap_plot_list( tag_levels = NULL, title = NULL, axis.font.family = NULL, + guides = "collect", + axes = "collect", + axis_titles = "collect", ... ) } @@ -19,7 +22,13 @@ wrap_plot_list( \item{title}{panel title} -\item{...}{ignored for argument overflow} +\item{guides}{passed to patchwork::wrap_plots()} + +\item{axes}{passed to patchwork::wrap_plots()} + +\item{axis_titles}{passed to patchwork::wrap_plots()} + +\item{...}{passed to patchwork::wrap_plots()} } \value{ list of ggplot2 objects