Skip to content

Apply the grid argument to the facet_grid layer of plot recipes - #686

Merged
strengejacke merged 1 commit into
easystats:mainfrom
jmgirard:hotfix-plot-recipe-grid
Oct 16, 2026
Merged

strengejacke merged 1 commit into
easystats:mainfrom
jmgirard:hotfix-plot-recipe-grid

Conversation

@jmgirard

Copy link
Copy Markdown
Contributor

.visualization_recipe() merged the facet argument into the facet_grid layer instead of grid. The facet grid is used for four or more by variables. So grid = list(scales = "free") failed with is.list(val) is not TRUE when facet was not set, and when both were set, facet changed the grid layer and grid was ignored.

data <- iris
data$fac <- rep_len(c("A", "B"), 150)
data$fac2 <- rep_len(c("X", "X", "X", "Y", "Y", "Y"), 150)
m <- lm(Sepal.Length ~ Species * fac * Sepal.Width * fac2, data = data)
x <- estimate_relation(m, by = c("Species", "Sepal.Width", "fac", "fac2"))

plot(x, grid = list(scales = "free"))  # previously: Error in utils::modifyList(): is.list(val) is not TRUE

Changes

  • .visualization_recipe() (R/visualisation_recipe_internal.R): the facet_grid layer is modified with grid, not facet.
  • Tests (tests/testthat/test-visualisation_recipe.R): the default scales = "free_x", grid applied to the layer, and facet leaving the layer unchanged.
  • NEWS entry and version bump to 0.17.0.16.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The reviewed changes address the reported issue with regression coverage and documentation updates.

0 open findings

What changed in this PR

Fixes grid handling for facet_grid layers in visualization recipes with four or more grouping variables.

Changes:

  • Applies grid customization to facet_grid.
  • Adds regression tests for defaults and argument interaction.
  • Updates NEWS and the development version.
File Description
tests/​testthat/​test-visualisation_recipe.R Adds regression coverage.
R/​visualisation_recipe_internal.R Corrects grid customization.
NEWS.md Documents the fix.
DESCRIPTION Bumps the development version.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@strengejacke
strengejacke merged commit bf2328a into easystats:main Oct 16, 2026
9 of 18 checks passed
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