From f2a522dcb6c33050b61d9640b6298e93dd332ccc Mon Sep 17 00:00:00 2001 From: Andreas Gammelgaard Damsbo Date: Fri, 29 May 2026 11:47:15 +0200 Subject: [PATCH] allows ... inputs in plot models --- R/hosted_version.R | 2 +- R/plot_bar.R | 6 +++--- R/plot_box.R | 4 ++-- R/plot_euler.R | 2 +- R/plot_hbar.R | 6 ++++-- R/plot_likert.R | 3 ++- R/plot_sankey.R | 3 ++- R/plot_scatter.R | 2 +- R/plot_violin.R | 5 +++-- examples/visuals_module_demo.R | 2 +- 10 files changed, 20 insertions(+), 15 deletions(-) diff --git a/R/hosted_version.R b/R/hosted_version.R index 33aaf67c..5a0a6546 100644 --- a/R/hosted_version.R +++ b/R/hosted_version.R @@ -1 +1 @@ -hosted_version <- function()'v26.4.2-260410' +hosted_version <- function()'v26.4.2-260528' diff --git a/R/plot_bar.R b/R/plot_bar.R index 0535b6f3..e9879ef3 100644 --- a/R/plot_bar.R +++ b/R/plot_bar.R @@ -39,14 +39,14 @@ plot_bar <- function(data, sec = sec, style = style, max_level = max_level, - color.palette = color.palette + color.palette = color.palette, + ... ) }) wrap_plot_list(out, title = glue::glue(i18n$t("Grouped by {get_label(data,ter)}")), - y.axis.percentage = TRUE, - ...) + y.axis.percentage = TRUE) } diff --git a/R/plot_box.R b/R/plot_box.R index 01911aac..4acd67ab 100644 --- a/R/plot_box.R +++ b/R/plot_box.R @@ -32,11 +32,11 @@ plot_box <- function(data, pri, sec, ter = NULL,color.palette="viridis",...) { data = .ds, pri = pri, sec = sec, - color.palette=color.palette + color.palette=color.palette, ... ) }) - wrap_plot_list(out,title=glue::glue(i18n$t("Grouped by {get_label(data,ter)}")),...) + wrap_plot_list(out,title=glue::glue(i18n$t("Grouped by {get_label(data,ter)}"))) } diff --git a/R/plot_euler.R b/R/plot_euler.R index 27cdf02f..a5a0d31f 100644 --- a/R/plot_euler.R +++ b/R/plot_euler.R @@ -131,7 +131,7 @@ plot_euler <- function(data, pri, sec, ter = NULL, seed = 2103,color.palette="vi #' D = sample(c(TRUE, FALSE, FALSE, FALSE), 50, TRUE) #' ) |> plot_euler_single() #' mtcars[c("vs", "am")] |> plot_euler_single("magma") -plot_euler_single <- function(data,color.palette="viridis") { +plot_euler_single <- function(data,color.palette="viridis", ...) { data |> ggeulerr(shape = "circle") + diff --git a/R/plot_hbar.R b/R/plot_hbar.R index d93ef4c9..1405678f 100644 --- a/R/plot_hbar.R +++ b/R/plot_hbar.R @@ -15,13 +15,15 @@ plot_hbars <- function(data, pri, sec, ter = NULL, - color.palette = "viridis") { + color.palette = "viridis", + ...) { vertical_stacked_bars( data = data, score = pri, group = sec, strata = ter, - color.palette = color.palette + color.palette = color.palette, + ... ) } diff --git a/R/plot_likert.R b/R/plot_likert.R index c18c57a1..e33256a2 100644 --- a/R/plot_likert.R +++ b/R/plot_likert.R @@ -15,7 +15,8 @@ plot_likert <- function(data, pri, sec = NULL, ter = NULL, - color.palette = "viridis") { + color.palette = "viridis", + ...) { if (!is.null(ter)) { ds <- split(data, data[ter]) } else { diff --git a/R/plot_sankey.R b/R/plot_sankey.R index 23c1a13a..409a1050 100644 --- a/R/plot_sankey.R +++ b/R/plot_sankey.R @@ -95,7 +95,8 @@ plot_sankey <- function(data, default.color = "#2986cc", box.color = "#1E4B66", na.color = "grey80", - missing.level = "Missing") { + missing.level = "Missing", + ...) { if (!is.null(ter)) { ds <- split(data, data[ter]) } else { diff --git a/R/plot_scatter.R b/R/plot_scatter.R index 142c30fd..8c73547e 100644 --- a/R/plot_scatter.R +++ b/R/plot_scatter.R @@ -8,7 +8,7 @@ #' @examples #' mtcars |> plot_scatter(pri = "mpg", sec = "wt") #' mtcars |> plot_scatter(pri = "mpg", sec = "wt",ter="carb") -plot_scatter <- function(data, pri, sec, ter = NULL, color.palette="viridis") { +plot_scatter <- function(data, pri, sec, ter = NULL, color.palette="viridis", ...) { if (is.null(ter)) { rempsyc::nice_scatter( data = data, diff --git a/R/plot_violin.R b/R/plot_violin.R index 83d11d2a..29850d26 100644 --- a/R/plot_violin.R +++ b/R/plot_violin.R @@ -8,7 +8,7 @@ #' @examples #' mtcars |> plot_violin(pri = "mpg", sec = "cyl") #' mtcars |> plot_violin(pri = "mpg", sec = "cyl", ter = "gear", color.palette="Blues") -plot_violin <- function(data, pri, sec, ter = NULL, color.palette="viridis") { +plot_violin <- function(data, pri, sec, ter = NULL, color.palette="viridis", ...) { if (!is.null(ter)) { ds <- split(data, data[ter]) } else { @@ -23,7 +23,8 @@ plot_violin <- function(data, pri, sec, ter = NULL, color.palette="viridis") { group = sec, response = pri, xtitle = get_label(data, var = sec), - ytitle = get_label(data, var = pri) + ytitle = get_label(data, var = pri), + ... )+ scale_fill_generate(palette=color.palette) }) diff --git a/examples/visuals_module_demo.R b/examples/visuals_module_demo.R index 00a8c020..e4883d6c 100644 --- a/examples/visuals_module_demo.R +++ b/examples/visuals_module_demo.R @@ -22,7 +22,7 @@ visuals_demo_app <- function() { ) ) server <- function(input, output, session) { - pl <- data_visuals_server("visuals", data = shiny::reactive(default_parsing(mtcars))) + pl <- data_visuals_server("visuals", data = shiny::reactive(default_parsing(mtcars)),palettes = color_choices()) } shiny::shinyApp(ui, server) }