These are all good cases to think about @zeileis . I've been playing around with some logic that makes more intuitive sense to me. I haven't pushed these changes yet---I can if you'd like to play around with them locally---but what do you think of the following?
(Aside: For some reason, it looks like our documentation warning about type_hline and co. only being viable for add = TRUE cases no longer holds. I'm okay with this in principle since I think these plots make sense. But we'll need to update the documentation once we settle on a finalized design / logic flow.)
Categorical by
I find myself in slight disagreement that all of the cases that you presented should result in a single line. (Assuming that you meant this as a point of desiderata, rather than a strict reading of the current documentation.) In particular, I think we should default to a single line, but only if the the user hasn't expressly passed a lwd/lty vector equal to the number of groups. For your examples, this cashes out as:
tinyplot(bill_len ~ flipper_len | sex, data = penguins, type = type_hline(45), lwd = 10, palette = "classic")
(single black line, since lwd and lty are singlular or null)
tinyplot(bill_len ~ flipper_len | sex, facet = ~ species, data = penguins, type = type_hline(45), lwd = c(21, 7), palette = "classic")
(double + color grouped lines, since lwd = no. of groups)
tinyplot(bill_len ~ flipper_len | sex, facet = ~ species, data = penguins, type = type_hline(c(35, 45, 55)), lwd = c(21, 7), palette = "classic")
(ditto, albeit with heights varying across facets due to h = no. of facets)
Continuous by
tinyplot(bill_len ~ flipper_len | body_mass, data = penguins, type = type_hline(seq(35, 55, length.out = 100)), lwd = 10)
(hlines matched to continuous color gradient due to match the number of groups; an admittedly special case but maybe useful for expert use)
tinyplot(bill_len ~ flipper_len | body_mass, facet = ~ species, data = penguins, type = type_hline(c(35, 45, 55)), lwd = 10)
(single hline per facet, since h = no. of facets)
Created on 2025-06-09 with reprex v2.1.1
Thoughts? Again, LMK if you'd like me to push these changes, so that you can grab them and play around with locally.