grantmcdermott · GitHub

Fixes #434.

@zeileis I followed your suggestion by adding a bit of extra space at the end of each legend label, so that they are closer to their own respective keys (rather than being equidistant between keys). Example:

pkgload::load_all("~/Documents/Projects/tinyplot")
#> ℹ Loading tinyplot
tinytheme('clean2')
aq = transform(
  airquality,
  Month = factor(month.name[Month], levels = month.name[5:9])
)
plt(Temp ~ Day | Month, data = aq, legend = "bottom!")

As part of this PR, I also addressed some limitations that we had w.r.t. to multicolumn legend support. These should work much better now and also provide an escape hatch for cases with many discrete labels that would otherwise overflow the plot region. I added an example to the "Tips & tricks" vignette along these lines.

plt(
  weight ~ Time | Chick,
  data = ChickWeight,
  legend = list(ncol = 3),
  type = "l"
)

Created on 2025-07-19 with reprex v2.1.1

Read the original on github.com ↗