From c44f6cca23e5935f91dd1062270ca62a3a180660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Revilla?= Date: Fri, 22 Nov 2024 12:46:27 +0100 Subject: [PATCH 1/2] Change y axis title in a decorator --- vignettes/decorate-module-output.Rmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vignettes/decorate-module-output.Rmd b/vignettes/decorate-module-output.Rmd index 15ed14e7ce..074530dfed 100644 --- a/vignettes/decorate-module-output.Rmd +++ b/vignettes/decorate-module-output.Rmd @@ -447,7 +447,7 @@ interactive_decorator_2 <- teal_transform_module( ui = function(id) { ns <- NS(id) div( - textInput(ns("x_axis_title"), "X axis title", value = "x axis 2") + textInput(ns("y_axis_title"), "Y axis title", value = "y axis 1") ) }, server = function(id, data) { @@ -457,9 +457,9 @@ interactive_decorator_2 <- teal_transform_module( within(data(), { plot <- plot + - xlab(title) + ylab(title) }, - title = input$x_axis_title + title = input$y_axis_title ) }) }) From 6207cc4184b179ee962a257ad4bf2a8edb6ede22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Revilla?= Date: Fri, 22 Nov 2024 12:53:16 +0100 Subject: [PATCH 2/2] Add minor introdcution to what each decorator will do. Reduces some line length --- vignettes/decorate-module-output.Rmd | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vignettes/decorate-module-output.Rmd b/vignettes/decorate-module-output.Rmd index 074530dfed..17061ec9c7 100644 --- a/vignettes/decorate-module-output.Rmd +++ b/vignettes/decorate-module-output.Rmd @@ -311,7 +311,9 @@ if (interactive()) { ### Example Module -It is possible to pass any number of decorators (n) to a module. The example below demonstrates how to handle a dynamic number of decorators, allowing the user to choose which decorator to apply from a list. This makes the module more flexible and capable of accommodating various customization requirements. +It is possible to pass any number of decorators (n) to a module. +The example below demonstrates how to handle a dynamic number of decorators, allowing the user to choose which decorator to apply from a list. +This makes the module more flexible and capable of accommodating various customization requirements. ```{r} library(ggplot2) @@ -418,6 +420,11 @@ tm_decorated_plot <- function(label = "module", decorators = NULL) { } ``` +By order of the decorator we will: + +1. Change the x axis title +2. Change the y axis title +3. Replace the x axis title ```{r} interactive_decorator_1 <- teal_transform_module( @@ -492,6 +499,8 @@ interactive_decorator_3 <- teal_transform_module( ### Application +As you might have noted, the x axis title from the first decorator will be used but won't show up on the resulting plot: + ```{r} app <- init( data = teal_data(iris = iris, mtcars = mtcars),