grantmcdermott · GitHub

added 5 commits

May 25, 2026 14:53
New themes: socviz, broadsheet, nber, web. Each targets a distinct
publication aesthetic (academic social science, newspaper, NBER working
papers, and 538-style web respectively).
Improvements to existing themes:
- ipsum: bold title, plain subtitle, no ticks, fine grid (xy),
  tighter spacing, custom palette per #408
- bw: smaller axis text (cex.axis=0.8), tighter gaps, fine grid (xy)
  to better match ggplot2 equivalent
- classic: same gap/cex adjustments as bw
- tufte/void: now dynamic (dynmar=TRUE) for responsive margins

@grantmcdermott

@grantmcdermott

@grantmcdermott

The gap between y-axis tick labels and the y-axis title previously
varied depending on label width (e.g., 1-digit vs 2-digit). Three
issues combined:
1. The whtsbp threshold used a cex-dependent value (min(1, 0.5*cex_axis))
   creating a discontinuity. Changed to fixed 0.5, which algebraically
   produces exactly gap.lab regardless of label width or theme settings.
2. The whtsbp bump was clamped to >= 0 in tinyplot.R, so narrow-label
   plots never adjusted their margin or title position. Now allows
   negative values so the margin and title shift inward together.
3. ymgp_shift (designed for cex_axis > 1) went negative for cex_axis < 1,
   pushing the title away from labels. Clamped with max(0, ...) in the
   title offset formula.
4. The no-facet dynmar path in facet.R had its own whtsbp calculation
   with a separate > 0 clamp that overrode the tinyplot.R computation.
   Removed that clamp to stay consistent.
Note: a pre-existing edge case remains where degenerate ylim (e.g.,
plt(1)) causes axisTicks to underestimate label width at pre-computation
time. This will be addressed in a follow-up.

Closed

When ylim has zero range (e.g., plt(1)), axisTicks underestimates
label width because extendrange produces a near-zero range. Expand
to ylim ± 0.5 to match what plot.window actually renders — but only
when yaxb is NULL (user-specified breaks already know the labels).
Closes #596

Closed

@grantmcdermott

@grantmcdermott

Closed

Read the original on github.com ↗