Skip to content

Fix 1-D facet_wrap, default theme minimal, file name <workflow>_<step>_plot, unit tests - #24

Merged
fnaji merged 4 commits into
masterfrom
faris/facet-wrap-strip-position
Oct 19, 2026
Merged

fnaji merged 4 commits into
masterfrom
faris/facet-wrap-strip-position

Conversation

@fnaji

@fnaji fnaji commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Any plot with one facet dimension, rows only or columns only, and wrap.1d = true fails. wrap.1d = true is the default. The failure happens in every release since the image started installing ggplot2 ≥ 3.5, including 1.0.19:

Error: The `switch` argument of `facet_wrap()` was deprecated in ggplot2 2.2.0 and is now defunct.
ℹ Please use the `strip.position` argument instead.
  └─global get_facet_formula(ctx, input.par$wrap.1d, input.par$scales)

It was first found on a local Studio on 30 September. A customer then hit it on tercen.com on 19 October with no rows and Donor × Sample on columns.

Changes

  • Facet fix. switch = "y" becomes strip.position = "left" in the facet_wrap branch of get_facet_formula. Strips stay on the left. facet_grid still accepts switch and is unchanged.
  • Default theme. The default changes from light to minimal. Existing steps store their theme, so only new steps pick up the new default.
  • Output file name. The default file name is now <workflow name>_<step name>_plot.png, built from the step's own names.
    • Spaces, slashes and other characters that don't belong in a file name become _, and long names are cut.
    • file.name.prefix now defaults to empty. Every existing step stores the old default Tercen_Plot, so that value is treated the same way as empty, and existing steps get the new name.
    • A prefix set by the user is kept.
    • In a multi-image run, the images are <prefix>_<row>_<column>.png and the zip is <prefix>.zip. This was checked on Studio, along with an unset prefix, Tercen_Plot and a custom prefix.
  • Unit tests in unit_tests/run.R.
    • Facet layouts. Each test builds the facet for a stand-in context and draws the whole chart. The cases are columns only and rows only with wrapping, no wrapping, and rows × columns. The wrapped cases fail on 1.0.19 with the customer's error.
    • File name. The default name, Tercen_Plot treated as the default, a custom prefix kept, unsafe characters, missing names and long names.
    • Settings. Every enumerated setting's default must be one of its values, the theme defaults to minimal, and every theme value must be a ggplot2 theme.

Verification

  • Customer's crosstab on local Studio. The projection is no rows, Donor × Sample on columns, label on x, wrap.1d = true. 1.0.19 fails in dodge, stack and fill. This branch draws all 25 panels in each mode. Stack and fill give one bar per panel, in x order.
  • CI. The unit-test workflow is green.

🤖 Generated with Claude Code

@fnaji
fnaji force-pushed the faris/facet-wrap-strip-position branch from 6870945 to 081a615 Compare September 30, 2026 10:25
fnaji and others added 2 commits October 19, 2026 19:51
facet_wrap(switch=) was deprecated in ggplot2 2.2.0 and is defunct in the
ggplot2 shipped in the 1.0.17 image, so every plot with a single facet
dimension and wrap.1d=true (the default) fails with
'The `switch` argument of `facet_wrap()` ... is now defunct'.
strip.position = "left" keeps the row labels on the left as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Builds the facet for a stand-in context and draws the whole chart, for
columns only and rows only with wrap.1d, no wrap, and rows x columns. The
wrapped cases fail on the defunct facet_wrap(switch=) with the error a
customer hit on tercen.com, and pass with strip.position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fnaji
fnaji force-pushed the faris/facet-wrap-strip-position branch from 081a615 to a1485ac Compare October 19, 2026 17:56
Plus a unit test that every EnumeratedProperty default is one of its
values and every theme value is a ggplot2 theme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fnaji fnaji changed the title Fix 1-D facet_wrap: strip.position instead of defunct switch Fix 1-D facet_wrap (defunct switch), default theme minimal, facet unit tests Oct 19, 2026
file.name.prefix now defaults to empty, which names the image (and the zip
of a multi-image run) after the step: <workflow name>_<step name>_plot,
with spaces, slashes and other unsafe characters as '_'. The old default
Tercen_Plot, which every existing step stores, is treated the same way;
a prefix set by the user is kept. Unit tests for the naming.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fnaji fnaji changed the title Fix 1-D facet_wrap (defunct switch), default theme minimal, facet unit tests Fix 1-D facet_wrap, default theme minimal, file name <workflow>_<step>_plot, unit tests Oct 19, 2026
@fnaji
fnaji merged commit 9a7c5b7 into master Oct 19, 2026
1 check passed
@fnaji
fnaji deleted the faris/facet-wrap-strip-position branch October 19, 2026 18:12
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.

1 participant