Skip to content

Require ggplot2 >= 3.5.2 and test it in CI - #121

Open
willgearty wants to merge 4 commits into
mainfrom
claude/require-ggplot2-3.5.2
Open

willgearty wants to merge 4 commits into
mainfrom
claude/require-ggplot2-3.5.2

Conversation

@willgearty

@willgearty willgearty commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Bumps the minimum ggplot2 version in DESCRIPTION from 3.5.0 to 3.5.2, and adds a CI job that actually tests it.

deeptime imports ggh4x, and ggh4x 0.3.1 already has Depends: ggplot2 (>= 3.5.2). It also calls ggplot2::is_theme_element(), which doesn't exist before 3.5.2, so deeptime couldn't actually be used with ggplot2 3.5.0 or 3.5.1. This makes that requirement explicit.

  • DESCRIPTION: ggplot2 (>= 3.5.0) → ggplot2 (>= 3.5.2)
  • NEWS.md: notes the new requirement, in the same style as the previous ggplot2 bump in 2.0.0
  • R-CMD-check.yaml:
    • Renames the ">= 3.5.2" matrix entry to release, which is what it installed in practice (the latest ggplot2, 4.0.3 in recent runs), so ggplot2 3.5.x was never tested.
    • Adds one job pinned to ggplot2 3.5.2 on ubuntu-latest with R release, via include:. It installs that exact version with remotes::install_version(), so the pre-4.0 test snapshots now run in CI.
    • The install step now only runs for pinned versions; for release, setup-r-dependencies already installs the current ggplot2.
    • The 3.5.2 job builds and checks without vignettes (--no-build-vignettes / --ignore-vignettes) and only fails on errors. Current versions of two suggested packages used in the vignettes require ggplot2 4.x: ggtree (Bioconductor 3.22) needs >= 4.0.0 and ggpattern needs >= 4.0.2. Skipping vignettes only produces a NOTE. Docs inherited from ggplot2 4.x also link to annotation_borders(), which 3.5.2 doesn't have, giving a Rd cross-reference WARNING. All other jobs keep the previous build options and still fail on warnings.
  • Tests, so the 3.5.2 job only fails on known issues:
    • test-guides.R: adds skip_if_not_installed("ggtree") to the two tests that used ggtree without it ("guide_geo works with coord_geo_radial" and the second "ggtree scale works with only fossil taxa"). With ggplot2 3.5.2, ggtree can't load, so these errored instead of skipping.
    • coord_geo pre-4.0 snapshots (_snaps/coord_geo/): updates "stacked scales with single pos" and adds the missing "stacked scales on top/bottom" and "on left/right". The updated snapshot only gains empty clip-path groups; its text, positions and shapes are unchanged. The two new ones match their ggplot4/ counterparts in label text, positions and shapes.

No package code changes were needed: all existing version checks are packageVersion("ggplot2") > "3.5.2". I checked that the package installs with ggplot2 3.5.2, and that installing with ggplot2 3.5.0 now fails with "namespace 'ggplot2' 3.5.0 is already loaded, but >= 3.5.2 is required". Locally, test-coord_geo.R and test-guides.R pass with ggplot2 3.5.2 (with and without ggtree available) and with 4.0.3.

Things to know:

AI disclosure: Claude identified the problem and drafted the change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A7zDoJJQSEuNmyB6xR3njB

ggh4x, which deeptime imports, already requires ggplot2 >= 3.5.2, so
deeptime could not be used with ggplot2 3.5.0 or 3.5.1 anyway. Make the
requirement explicit in DESCRIPTION.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01A7zDoJJQSEuNmyB6xR3njB
The ">= 3.5.2" matrix entry installed the latest ggplot2, so ggplot2
3.5.x was never tested. Rename it to "release" and add a job pinned to
ggplot2 3.5.2 on ubuntu-latest with R release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01A7zDoJJQSEuNmyB6xR3njB
@willgearty willgearty changed the title Require ggplot2 >= 3.5.2 Require ggplot2 >= 3.5.2 and test it in CI Oct 14, 2026

Copy link
Copy Markdown
Owner Author

The new ubuntu-latest (release, ggplot2 3.5.2) job fails while building the vignettes, before any tests run. Current versions of two suggested packages already require ggplot2 4.x:

  • ggtree (Bioconductor 3.22) requires ggplot2 >= 4.0.0, which breaks the ggarrange2 and phylogenies vignettes.
  • ggpattern requires ggplot2 >= 4.0.2, which breaks the geo vignette.

I reproduced the rest of the check locally with ggplot2 3.5.2, without vignettes and with ggtree/ggpattern unavailable. Getting this job green would also need:

  1. Building and checking without vignettes for this job, which only produces a NOTE.
  2. error-on: "error" for this job. Docs inherited from ggplot2 4.x link to annotation_borders(), which ggplot2 3.5.2 doesn't have, so Rd cross-references give a WARNING.
  3. The coord_trans_xy pre-4.0 snapshot fix from Fix coord_trans_xy() axis labels with ggplot2 < 4.0.0 #117 (2 failures).
  4. skip_if_not_installed("ggtree") in two guides tests that use ggtree without it (test-guides.R:184 and :200).
  5. A look at the pre-4.0 coord_geo "stacked scales with single pos" snapshot, and possibly the pre-4.0 pattern snapshots.

That's more than a version bump, so I'm checking with the maintainer before widening this PR.


Generated by Claude Code

Current versions of ggtree and ggpattern, used in the vignettes, require
ggplot2 >= 4.0.0, so the vignettes cannot be built with ggplot2 3.5.2.
Build and check without vignettes in that job, and only fail on errors,
since docs inherited from newer ggplot2 versions give Rd xref warnings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01A7zDoJJQSEuNmyB6xR3njB

Copy link
Copy Markdown
Owner Author

Update after 2868b97: the ggplot2 3.5.2 job now gets past the vignettes and docs (the Rd cross-reference WARNING is reported but no longer fails the job), and only the tests fail. That's expected, since test fixes are being left to separate PRs. CI shows 10 failures, and on CI a missing snapshot counts as a failure:

  • test-coord_trans_xy.R (5): 2 outdated and 3 missing pre-4.0 snapshots. All are fixed by Fix coord_trans_xy() axis labels with ggplot2 < 4.0.0 #117.
  • test-coord_geo.R (3): the pre-4.0 "stacked scales with single pos" snapshot is outdated (line 88), and the "stacked scales on top/bottom" and "on left/right" snapshots only exist under ggplot4/ (lines 120 and 129). No PR covers these yet.
  • test-guides.R (2, lines 184 and 200): these use ggtree without skip_if_not_installed("ggtree"), and ggtree can't load with ggplot2 3.5.2. No PR covers these yet.

The pattern snapshots pass on CI, so their earlier local failures were specific to my environment. The geom_text_clade tests are skipped in this job because ggtree can't load.


Generated by Claude Code

Skip the two guide tests that use ggtree when it is not available, and
add/update the pre-4.0 coord_geo stacked scale snapshots. The updated
snapshot only gains empty clip-path groups; its text and shapes are
unchanged, and the new ones match their ggplot4 counterparts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01A7zDoJJQSEuNmyB6xR3njB

This branch has not been deployed

No deployments
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.

2 participants