Fixes #493
Jitter layers added via tinyplot_add() now align correctly with grouped boxplot, violin, and ridge base layers.
Operationalized through the new group_offset setting, which the different data_* constructor functions can access. This also means that offsets are calculated ahead of time, instead of during the drawing phase (which is probably more robust anyway).
MWEs:
pkgload::load_all('~/Documents/Projects/tinyplot') #> ℹ Loading tinyplot plt( body_mass ~ sex | species, data = penguins, flip = TRUE, type = "box", theme = "clean" ) plt_add(type = "j", cex = 0.5)
plt( body_mass ~ sex | species, data = penguins, flip = TRUE, type = "violin", bg = 0.2, theme = "clean" ) plt_add(type = "j", cex = 0.5)
The "ridge" layering still doesn't look great b/c the colours don't inherit from the base layer and points near the baseline may be clipped by ylim... But those are separate issues IMO.
plt( sex ~ body_mass, data = penguins, type = "ridge", theme = "ridge" ) plt_add(type = "j", cex = 0.5)
Created on 2026-03-23 with reprex v2.1.1