Skip to content

Fix gglot2 args parsing - #369

Merged
llrs-roche merged 11 commits into
mainfrom
fix-gglot2_args
Nov 3, 2026
Merged

llrs-roche merged 11 commits into
mainfrom
fix-gglot2_args

Conversation

@osenan

@osenan osenan commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #345

It is based on this PR but with a simpler solution that adds less code complexity. The issue was created due to wrong process of ggplot2 elements back to calls due to the existing parsing functions. The current PR adds the extra processing only for specific ggplot2 elements and return the remaining as they were or with as.call as it was the previous teal.widgets procedure.

The following app will work:

devtools::load_all()
library(teal)
library(teal.modules.general)

tdm <- teal_data_module(
  ui = function(id) {
    ns <- NS(id)
    actionButton(ns("submit"), label = "Load data")
  },
  server = function(id) {
    moduleServer(id, function(input, output, session) {
      eventReactive(input$submit, {
        data <- within(
          teal_data(),
          {
            iris <- iris
            mtcars <- mtcars
          }
        )
        data
      })
    })
  }
)

app <- init(
  data = tdm,
  modules = modules(
    tm_g_distribution(
      dist_var = data_extract_spec(
        dataname = "iris",
        select = select_spec(variable_choices("iris"), "Petal.Length")
      ),
      ggplot2_args = teal.widgets::ggplot2_args(
        theme = list(text = element_text(size = 20))
      )
    )
  ),
  title = "my teal app"
)

shinyApp(app$ui, app$server)

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

badge

Code Coverage Summary

Filename                      Stmts    Miss  Cover    Missing
--------------------------  -------  ------  -------  -------------------------------------------------------
R/basic_table_args.R             23       0  100.00%
R/draggable_buckets.R            87      12  86.21%   116-121, 151-156
R/get_dt_rows.R                  13       0  100.00%
R/ggplot2_args.R                 65       1  98.46%   186
R/nested_closeable_modal.R       20      20  0.00%    83-103
R/optionalInput.R               255      79  69.02%   190, 315-389, 402-409, 411-416, 434, 436, 501, 583-596
R/panel_group.R                  39       8  79.49%   72-79
R/plot_with_settings.R          314      17  94.59%   301-307, 329, 366, 375-376, 392, 583-584, 586, 588, 622
R/standard_layout.R              52       4  92.31%   90-93
R/table_with_settings.R         258       6  97.67%   198, 424-428
R/utils.R                        37       1  97.30%   13
R/verbatim_popup.R              104      35  66.35%   112-113, 115, 123-154
R/white_small_well.R              7       0  100.00%
TOTAL                          1274     183  85.64%

Diff against main

Filename                  Stmts    Miss  Cover
----------------------  -------  ------  -------
R/ggplot2_args.R            +16      +1  -1.54%
R/plot_with_settings.R       +2      +1  -0.29%
R/utils.R                    +2      +1  -2.70%
TOTAL                       +20      +3  -0.01%

Results for commit: 33ef4bc

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Unit Tests Summary

  1 files   17 suites   16s ⏱️
188 tests 159 ✅ 29 💤 0 ❌
366 runs  335 ✅ 31 💤 0 ❌

Results for commit 33ef4bc.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Unit Test Performance Difference

Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
ggplot2_args 👶 $+0.01$ parse_ggplot2_args_handles_element_rect
ggplot2_args 👶 $+0.01$ parse_ggplot2_args_handles_element_text_with_custom_margin
ggplot2_args 👶 $+0.01$ parse_ggplot2_args_handles_rel_in_theme
ggplot2_args 👶 $+0.01$ parse_ggplot2_args_preserves_already_quoted_theme_calls_unchanged

Results for commit 777e5bf

♻️ This comment has been updated with latest results.

@osenan
osenan requested a review from a team October 22, 2026 10:05
Comment thread R/ggplot2_args.R Resolved
Comment thread DESCRIPTION Resolved
@llrs-roche llrs-roche self-assigned this Nov 3, 2026

@llrs-roche llrs-roche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor comment, but it looks good and ready to merge.

Comment thread DESCRIPTION Resolved
Comment thread R/ggplot2_args.R Resolved
@llrs-roche
llrs-roche enabled auto-merge (squash) November 3, 2026 14:28
@llrs-roche
llrs-roche merged commit 7ad6766 into main Nov 3, 2026
26 of 27 checks passed
@llrs-roche
llrs-roche deleted the fix-gglot2_args branch November 3, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants