Theme refinement and new additions#595
Conversation
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
|
These are very nice, well done! Should there be a couple more pixels between the title and subtitle? |
I'm not sure if we want to change the defaults (although perhaps for some themes...) But we can certainly try to give users more control. Currently, we use hardcoded gaps of 0.7 (plot to sub) and 0.2 (sub to main), respectively. Let me implement |
|
makes sense. TBH, htis is very low priority. Should probably just move forward with what you have now. |
|
📈 Wow, very nice. Great to see how powerful themes became! 🎨 I just wondered about the Okabe-Ito palette: When did you go with the full version (with black as the first color) and when with the reduced one? |
I don' t have a super principled answer, but the gist is that I default to the full version except for a few cases where the theme I'm mimicking/borrowing from uses the 'reduced' version. On that note: I can't find the issue right now, but some time ago we talked about dropping black as the leading colour for grouped |
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.
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
|
@vincentarelbundock I've bumped the default the spacing between the pkgload::load_all("~/Documents/Projects/tinyplot")
#> ℹ Loading tinyplot
tinytheme("ipsum", family = "Arial Narrow")
plt(bill_len ~ bill_dep | species, data = penguins,
main = "ipsum + Arial Narrow",
sub = "The theme's intended font pairing",
cap = "Source: Gorman et al. (2014)")Created on 2026-05-29 with reprex v2.1.1 |
Thanks @zeileis, that's actually a great example. This PR was sprawling a bit too much, so I've decided to merge as-is. We can tackle this palette issue in a separate PR/thread. |
|
Yes, definitely, this shouldn't block the work on any other Issues/PRs. I just thought that it would be a good place to mention it so that we keep it on our radars. Regarding the example: The problem became painfully obvious to me when I prepared the "pairs plot" example in #347 (comment) where the inconsistencies in the single-group color handling are a bit distracting. |
|
Actually, do you mind flagging these in a separate issue so we can keep track? Thanks! |
|
Done in #598 |


Closes #409
Closes #596
Closes #597
Summary
"socviz","broadsheet","nber", and"web". The first obviously mimics @kjhealy's ggplot2 theme, while the latter three themes target newspaper/publication, NBER working paper, and FiveThirtyEight-style web aesthetics respectively."tufte"and"void"are now dynamic (responsive margins)."ipsum"overhauled to better match hrbrthemes (bold title, no ticks, granular grid, tighter spacing, custom palette). The original variant is preserved as"ipsum2"(Improvetinytheme("ipsum")? #409)."bw"and"classic"now use smaller axis text (cex.axis = 0.8), tighter spacing (gap.axis = 0.1,gap.lab = 0.4), and a more granular grid (grid = "xy") to better match their ggplot2 counterparts.Not addressed (potential follow-ups)
"ggplot"palette for ggplot2-inspired themes (I kept Okabe-Ito for now).systemfonts::match_family()) for themes that prefer specific fonts (e.g., ipsum → Roboto Condensed, socviz → Source Sans 3).facet.adjandfacet.paddingparameters for finer strip control.tinytheme_register(); Named user-defined themes not allowed inmain(allowed in released version) #579).Examples
# Reset tinytheme()Created on 2026-05-29 with reprex v2.1.1