Skip to content

v1.3.1: modern theme refresh, new theme/group.mean.overlay arguments#7

Merged
xuyiqing merged 3 commits into
devfrom
modern-theme
May 14, 2026
Merged

v1.3.1: modern theme refresh, new theme/group.mean.overlay arguments#7
xuyiqing merged 3 commits into
devfrom
modern-theme

Conversation

@xuyiqing
Copy link
Copy Markdown
Owner

Summary

Plot-system refresh for v1.3.1. Drop-in upgrade with two opt-in arguments and a soft deprecation.

Visual refresh (all four plot types):

  • Plain left-aligned titles at base size 11, white status-heatmap background, subtle major-x gridlines on trajectories, thin gray dashed treatment-onset marker.
  • Multi-level discrete-status palette refreshed to a muted, perceptually distinct sequence.
  • Outcome control trajectories lightened to grey75; binary blue cascade and continuous gradient unchanged.
  • Outcome draw order fixed via three explicit geom_line layers (cotrtr.pst). The previous single geom_line(group=id) drew in id order, not type order, so treated trajectories were being covered by the control band.
  • by.group / by.group.side suptitle (textGrob path) now routes through the modern title style via a new .pv_modern_top_grob helper.

New arguments:

  • theme = c("default", "red") — opt-in "red" theme activates a high-contrast publication-paper recipe (gray control / dark-gray treated-pre / brick-red treated-post + solid-black dashed onset marker).
  • group.mean.overlay = FALSE — when TRUE, dims per-unit trajectories and overlays a heavy group-mean line plus a 10–90% quantile ribbon per treatment-status group. Scoped to the main DID continuous-outcome path.

Deprecations:

  • theme.bw = FALSE is soft-deprecated. Still functional; emits a one-time warning per call. The tutorial no longer demonstrates it.

Tutorial:

  • New "Themes" subsections in 01-treat and 02-outcome.
  • New red-theme demo in 03-bivariate.
  • Capacity-dataset demo showing all three legend categories (Under Control, Under Treatment, Missing).
  • v1.3.1 entry added to the changelog chapter; index version table + argument table updated.

Backwards compatibility:

  • Default behavior unchanged for existing users except for the visual refresh (titles, background, palette).
  • Pre-1.3.1 visuals can be largely recovered by setting theme.bw = FALSE (with the deprecation warning).

Test plan

  • devtools::test() — 116/116 pass
  • R CMD check --as-cran on the built tarball — Status: OK (0 errors / 0 warnings / 0 notes, including a clean CRAN-incoming-feasibility check)
  • Clean-cache quarto render of all 7 tutorial chapters — succeeds; new figures (treat2-theme-red-*, outcome1-3*, bivar1-6b) render correctly
  • Smoke-tested user-reported scenarios: outcome plot draw order, control gray density, theme.bw = FALSE deprecation warning, by.group title alignment

🤖 Generated with Claude Code

xuyiqing and others added 3 commits May 13, 2026 17:36
Visual refresh across all four plot types (treat / outcome / bivariate / network):

* Plain left-aligned titles at base size 11, white background for status
  heatmaps, subtle major-x gridlines for trajectories, thin gray dashed
  treatment-onset marker (replaces prior thick white separator).
* Multi-level discrete-status palette refreshed to a muted, perceptually
  distinct sequence; binary blue cascade and continuous gradient unchanged.
* Outcome control trajectories lightened to grey75 so dense overlapping
  lines no longer darken into a near-black band.
* Outcome draw order fixed: controls now render at the bottom, treated-pre
  next, treated-post on top -- via three explicit geom_line layers (single
  geom_line(group=id) was drawing in id order, not type order, so treated
  trajectories were being covered by the control band).
* by.group / by.group.side suptitle (textGrob path) routed through the
  modern title style via a new .pv_modern_top_grob helper (28 call sites).

New arguments:

* `theme = c("default", "red")`. The "red" theme activates a high-contrast
  publication-paper recipe: gray control / dark-gray treated-pre /
  brick-red treated-post for status and outcome plots, plus a solid black
  dashed treatment-onset marker.
* `group.mean.overlay = FALSE`. When TRUE, the outcome plot dims per-unit
  trajectories and overlays a heavy group-mean line plus a 10-90% quantile
  ribbon per treatment-status group. Currently scoped to the main DID
  continuous-outcome path.

Deprecations:

* `theme.bw = FALSE` is soft-deprecated -- still functional for backwards
  compatibility but emits a one-time warning per call. The tutorial no
  longer demonstrates it.

Tutorial:

* New "Themes" subsections in 01-treat and 02-outcome chapters; new red-
  theme demo in 03-bivariate chapter.
* Demo of theme="red" handling all three categories (Under Control,
  Under Treatment, Missing) on the capacity dataset.
* New v1.3.1 changelog entry; index version table + argument table
  updated for the two new arguments.

Validation: R CMD check --as-cran on the built tarball returns Status: OK
(0 errors / 0 warnings / 0 notes). 116/116 testthat tests pass. Clean-cache
Quarto book render of all 7 chapters succeeds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Update install table to CRAN 1.3.1 across all three rows; add CRAN release
line (2026-05-13) to v1.3.1 changelog entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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