grantmcdermott / tinyplot

Lightweight extension of the base R graphics system
https://grantmcdermott.com/tinyplot
Apache License 2.0
211 stars 7 forks source link

Extra pointrange and errorbar support #40

Closed grantmcdermott closed 1 year ago

grantmcdermott commented 1 year ago

Closes #38. Also closes #39.

Examples:

library(plot2)
par(pch = 19)

mod = lm(mpg ~ hp + factor(cyl), mtcars)
coefs = data.frame(names(coef(mod)), coef(mod), confint(mod))
coefs = setNames(coefs, c("x", "y", "ymin", "ymax"))

with(
  coefs,
  plot2(
    x = x,
    y = y,
    ymin = ymin,
    ymax = ymax,
    type = "pointrange"
  )
)


with(
  coefs,
  plot2(
    x = x,
    y = y,
    ymin = ymin,
    ymax = ymax,
    type = "errorbar"
  )
)

Created on 2023-06-19 with reprex v2.0.2

grantmcdermott commented 1 year ago

I know everyone is busy with impending travels etc. and I'm pretty confident that this PR is good to go. So I'm happy to merge this as is, but please feel free to ping if you spot something problematic.