diff --git a/vignettes/decorate-module-output.Rmd b/vignettes/decorate-module-output.Rmd index d1bea0e371..5e5cdd650e 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( @@ -447,7 +454,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 +464,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 ) }) }) @@ -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),