mjskay / ggdist

Visualizations of distributions and uncertainty
https://mjskay.github.io/ggdist/
GNU General Public License v3.0
848 stars 26 forks source link

Currying not working for `stat_dotsinterval()` #221

Closed fkohrt closed 6 months ago

fkohrt commented 6 months ago

The following code using currying / automatic partial function application does not run, but produces a warning message:

faithful |>
  ggplot2::ggplot(ggplot2::aes(x = eruptions)) +
  ggdist::stat_dotsinterval(
    point_interval = ggdist::point_interval(
      .interval = ggdist::qi
    )
  )
Warning message:
Computation failed in `stat_dotsinterval()`.
Caused by error in `length(col_exprs) == 1 && .simple_names`:
! invalid 'y' type in 'x && y' 

Only using purrr::partial() works:

faithful |>
  ggplot2::ggplot(ggplot2::aes(x = eruptions)) +
  ggdist::stat_dotsinterval(
    point_interval = purrr::partial(
      ggdist::point_interval,
      .interval = ggdist::qi
    )
  )
mjskay commented 6 months ago

Thanks --- this was an issue with how point_interval(<distribution>) does non-standard evaluation, fix incoming.

fkohrt commented 6 months ago

Awesome, thank you! Love this package :)