-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
Adding an abline to a (simple) tinyplot works much the same as base plot().
library(tinyplot)
library(marginaleffects)
fit = lm(Sepal.Length ~ (Sepal.Width + Petal.Length + Petal.Width) * Species, iris)
mfx = avg_slopes(fit, variables = c("Sepal.Width", "Petal.Length", "Petal.Width"))
with(
mfx,
plt(
x = term, y = estimate, ymin = conf.low, ymax = conf.high,
type = "errorbar", pch = 19
)
)
abline(h = 0, lty = 2, col = "hotpink")So far so good. But unfortunately this approach doesn't work for faceted plots:
mfx2 = avg_slopes(fit, variables = c("Sepal.Width", "Petal.Length", "Petal.Width"), by = "Species")
with(
mfx2,
plt(
x = term, y = estimate, ymin = conf.low, ymax = conf.high,
type = "errorbar", pch = 19,
facet = Species, facet.args = list(bg = "gray90"), frame = FALSE
)
)
abline(h = 0, lty = 2, col = "hotpink")I don't see a good way to support the standard way of adding of ablines to faceted plots post hoc. (Too many complications.) But we could potentially support an abline argument that would draw the required line during each facet, and similarly for single facet plots too. Something like:
tinyplot(..., abline = list(h = 0))Thoughts
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

