Thanks @zeileis. I believe that I've managed to plug those two cases now:
pkgload::load_all("~/Documents/Projects/tinyplot_vincent/") #> ℹ Loading tinyplot set.seed(0) d <- data.frame(y = rep(1:4, each = 100), x = c( rnorm(100, mean = 5, sd = 2), rnorm(100, mean = 2, sd = 1), rnorm(100, mean = 8, sd = 1), rnorm(50, mean = 1, sd = 0.5), rnorm(50, mean = 9, sd = 0.5) )) tinyplot(y ~ x, data = d, type = type_ridge(bw = 0.5, gradient = TRUE, breaks = -1:6 * 2))
tinyplot(y ~ x, data = d, type = type_ridge(bw = 0.5, breaks = -1:6 * 2))
Bonus: Replicating a fun example from the ggridges package/vignette. Note that this is a case where grid = TRUE gives misaligned horizontal lines (due do the y-axis scaling?). But we can deploy draw as a workaround. (Something to think about fixing. Maybe part of a dedicated tinytheme("ridges") theme that also does things like removing the y-axis label?)
data(lincoln_weather, package = "ggridges") op = tpar(las = 1, mgp = c(3, 0, 0)) tinyplot( Month ~ `Max Temperature [F]`, data = lincoln_weather, type = type_ridge(gradient = "plasma", scale = 3), # grid = grid(nx = NA, ny = 12), draw = abline(h = 0:11, col = "lightgray"), axes = "l", main = "Temperatures in Lincoln NE", ylab = NA )
tpar(op)Created on 2024-11-22 with reprex v2.1.1