Skip to content

Release ssdtools 2.7.0, removing the ggtext dependency - #483

Merged
aazizish merged 11 commits into
bcgov:mainfrom
poissonconsulting:dev
Aug 31, 2026
Merged

aazizish merged 11 commits into
bcgov:mainfrom
poissonconsulting:dev

Conversation

@joethorley

@joethorley joethorley commented Aug 30, 2026 •

Copy link
Copy Markdown
Collaborator

Releases ssdtools 2.7.0. Closes #482.

The 2.7.0 version bump and full CRAN release prep were added in poissonconsulting#192, so this PR now carries the whole release rather than the ggtext change alone.

Why this is time sensitive

On 22 August the CRAN team gave notice that ggtext is scheduled for archival on 2026-09-12, and that archiving it would necessitate archiving its strong reverse dependencies. ssdtools 2.6.0, the version currently on CRAN, has ggtext in Imports. So 2.7.0 needs to be accepted, not merely submitted, before that date.

Removing ggtext

ggtext had a single call site, axis.text.x = ggtext::element_markdown() in ssd_plot(), needed only because ssd_label_comma_hc() emitted markdown (<br>**x**) to put the hazard concentration break on its own line in bold.

  • ssd_label_comma_hc() now prefixes the hazard concentration label with a newline rather than marking it up as markdown.
  • ssd_element_text_hc() is a new exported theme element that draws multi-line labels in bold. ssd_plot() uses it for axis.text.x.
  • ggtext removed from Imports, with nothing added in its place.

The element is fifteen lines. It receives the whole label vector at draw time, computes the fontface vector from the labels, and hands it to ggplot2's own element_text() path, where gpar recycles fontface across labels. Bolding the whole label is harmless because its first line is empty. All margin, justification and rotation handling stays in ggplot2.

ssd_element_text_hc() is exported so that callers of ssd_label_comma_hc() in their own plots have a replacement for the role ggtext::element_markdown() played.

Bug fixed along the way

ssd_label_comma_hc() compared a formatted string against a coerced number, so any big.mark or decimal.mark that altered the formatting stopped the hazard concentration from being matched, leaving it unbolded and inline. It is now formatted with the same labeller before comparison.

This was visible in a checked-in snapshot: _snaps/ssd-plot/boron_decimark.png previously rendered 1-26 plain and inline, colliding with the neighbouring 0-1 label.

Appearance

Measured against the previous ggtext output, in the 400x400 snapshot:

ggtext this
hazard concentration label rows 375-380, cols 167-182 identical
ordinary label row rows 359-364 rows 358-363
bold on quartz png() yes yes
bold on cairo and ragg yes yes

18 of the 36 plot snapshots are byte-identical to the ggtext originals and so do not appear in the diff: all 6 autoplot, all 10 plot-cdf, match-moments/cdf and ssd-plot/boron_nohc. The 18 that changed are exactly the plots carrying a hazard concentration label, and differ only by a one pixel shift of the ordinary label row.

Alternatives considered

marquee was tried and rejected: it ignores <br>, collapses single newlines and drops a leading empty paragraph, so the label collides with its neighbour unless a visible placeholder holds the first line open, and bold renders only on cairo and ragg, not on the macOS quartz device that grDevices::png() defaults to. Vendoring ggtext was also rejected: it delegates to gridtext::richtext_grob(), so it would swap ggtext for gridtext rather than removing the dependency, and would mean copying about 157 lines including two ggplot2-private helpers plus MIT attribution into an Apache-2.0 package.

Caveat

The element relies on element_grob S3 dispatch over ggplot2's S7 element classes, the same compatibility shim ggtext itself uses. If ggplot2 removes it this breaks, but it is fifteen lines under our own control.

Release prep

Version bumped to 2.7.0 and the four development NEWS sections consolidated into one. CRAN submission fixes:

Item Change
Remotes: open-AIMS/ssddata Removed. ssddata 2.0.0 is on CRAN, and the submitted 2.6.0 DESCRIPTION carried no Remotes field either
Config/roxygen2/version: 8.0.0.9000 Re-documented with the released roxygen2 8.1.0. NAMESPACE unchanged
Description: Posthuma et al.(2001) -> et al. (2001)
tests/testthat/test-hc.R structure(list(), .Names = ...) -> names =. R-devel notes the deprecated special name; the two forms are identical()
vignettes/references.bib One http URL -> https
cran-comments.md Was stale at 2.3.0. Rewritten for 2.7.0

VGAM also moved from Suggests to Imports. In 2.6.0 sgompertz() opened with rlang::check_installed("VGAM"), which prompts interactively; that guard is gone, so VGAM is now a hard dependency and fitting the Gompertz distribution no longer prompts.

Checks

  • win-builder R-devel (r90452 ucrt): Status: OK, 0 notes
  • CI: 9/9 pass, covering ubuntu devel / release / oldrel-1, windows, macOS, plus check-no-suggests
  • R CMD check --as-cran: 0 errors, 0 warnings, 0 notes
  • revdepcheck::revdep_check() against CRAN 2.6.0: GenHMM1d 0.2.6 and serocalculator 1.4.1 both clean. 0 new problems, 0 failures
  • urlchecker::url_check(): all 67 URLs pass

🤖 Generated with Claude Code

joethorley and others added 7 commits August 6, 2026 10:01
fledge derived the entry from merge-commit subjects because the PR
lookups 404'd: this repo is a fork of bcgov/ssdtools and the merge
commits reference upstream PR numbers (bcgov#472, bcgov#478, bcgov#480, bcgov#481) that do
not exist in poissonconsulting/ssdtools. That left four raw
'Merge pull request' bullets plus a duplicate of the 2.6.0.9002 entry.

Replaced with the user-facing changes since v2.6.0.9002.
`ssd_label_comma_hc()` now returns plotmath expressions rather than markdown,
so the hazard concentration axis label is bold on its own line without
`ggtext::element_markdown()`.

The hazard concentration is now matched on the formatted label, which fixes the
label when `big.mark` or `decimal.mark` change the formatting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replaces the plotmath expression with `ssd_element_text_hc()`, which
computes the fontface vector from the labels at draw time and hands it to
ggplot2's own `element_text()` path. Bolding the whole label is harmless
because the first line is empty, so `ssd_label_comma_hc()` only has to
prefix the value with a newline.

This keeps the hazard concentration label exactly where
`ggtext::element_markdown()` drew it, pixel for pixel, and unlike marquee
the bold renders on every device rather than only on cairo and ragg. All
the margin, justification and rotation handling stays in ggplot2.

18 of the 36 plot snapshots are byte-identical to the ggtext originals;
the rest differ only by a one pixel shift of the ordinary label row.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The pull request was branched from main, so the bullets landed under
2.6.0.9002. The changes are in 2.6.0.9003, which restores that section to
what it is on main.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Version bumped from 2.6.0.9003 and the four development NEWS sections
consolidated into a single 2.7.0 section.

CRAN submission fixes:

- Drop the Remotes field. ssddata 2.0.0 is on CRAN and the 2.6.0
  submission carried no Remotes field either.
- Re-document with the released roxygen2 8.1.0 rather than 8.0.0.9000.
  NAMESPACE is unchanged.
- Add the missing space in "Posthuma et al. (2001)" in Description.
- Fix an http URL in vignettes/references.bib.
- Rewrite cran-comments.md, which was stale at 2.3.0.

NEWS now records that VGAM moved from Suggests to Imports, so fitting
the Gompertz distribution no longer prompts to install it.

R CMD check --as-cran is clean and revdepcheck reports 0 new problems
across GenHMM1d and serocalculator.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
joethorley and others added 3 commits August 30, 2026 12:57
R-devel notes calls to structure() using deprecated special names.
win-builder flagged the zero-length list test as the only occurrence:

  Found calls to structure() using deprecated special names:
    ssdtools/tests/testthat/test-hc.R (.Names: 1)
  '.Names' should be changed to 'names'.

structure(list(), names = character(0)) is identical() to the .Names
form, so the test is unchanged in substance.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@joethorley joethorley changed the title Remove the ggtext dependency ahead of its CRAN archival Release ssdtools 2.7.0, removing the ggtext dependency Aug 30, 2026
@aazizish
aazizish merged commit e1c8632 into bcgov:main Aug 31, 2026
11 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.

Remove dependency on ggtext

2 participants