rivasiker / ggHoriPlot

A user-friendly, highly customizable R package for building horizon plots in ggplot2
https://rivasiker.github.io/ggHoriPlot/
138 stars 2 forks source link

Deprecated usage of `size` aesthetic #2

Closed fkohrt closed 1 week ago

fkohrt commented 2 weeks ago

Running the following:

withr::with_options(list(
  lifecycle_verbosity = "warning",
  warn = 1
), {
  plt <- faithful$eruptions |>
    density() |>
    (\(dat) data.frame(x = dat$x, y = dat$y))() |>
    ggplot2::ggplot(ggplot2::aes(x = x, y = y)) +
    ggHoriPlot::geom_horizon(
      origin = "min"
    ) +
    ggplot2::coord_cartesian(
      ylim = c(-0.5, 0.5)/0.5 + 0.5
    ) +
    ggHoriPlot::scale_fill_hcl()
  print(plt)
})

...leads to the following warning message:

Warning: Using the `size` aesthetic in this geom was
deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` in the `default_aes` field
  and elsewhere instead.
rivasiker commented 2 weeks ago

@fkohrt, thanks for pointing this out! I have updated the code to get rid of the warning (404d12a). You can install the most recent development version of ggHoriPlot by running devtools::install_github("rivasiker/ggHoriPlot").

fkohrt commented 2 weeks ago

Awesome, thank you very much! I was very delighted to see that a ggplot2 package for horizon plots exists! :)

Running it again, I discovered yet another deprecation:

withr::with_options(list(
  warnPartialMatchArgs = TRUE,
  warnPartialMatchDollar = TRUE,
  warnPartialMatchAttr = TRUE,
  warn = 2,
  lifecycle_verbosity = "error"
), {
  plt <- faithful$eruptions |>
    density() |>
    (\(dat) data.frame(x = dat$x, y = dat$y))() |>
    ggplot2::ggplot(ggplot2::aes(x = x, y = y)) +
    ggHoriPlot::geom_horizon(
      origin = "min"
    ) +
    ggplot2::coord_cartesian(
      ylim = c(-0.5, 0.5)/0.5 + 0.5
    ) +
    ggHoriPlot::scale_fill_hcl()
  print(plt)
})

...giving:

Error:
! The `scale_name` argument of `discrete_scale()` is deprecated as of ggplot2 3.5.0.
Backtrace:
    ▆
 1. ├─withr::with_options(...)
 2. │ └─base::force(code)
 3. └─ggHoriPlot::scale_fill_hcl()
 4.   └─ggplot2::discrete_scale("fill", "hcl", palette = pal, ...)
 5.     └─ggplot2:::deprecate_soft0("3.5.0", "discrete_scale(scale_name)")
 6.       └─lifecycle::deprecate_soft(..., user_env = user_env)
 7.         └─lifecycle:::deprecate_stop0(msg)
 8.           └─rlang::cnd_signal(...)
rivasiker commented 1 week ago

@fkohrt, again, thank you! These deprecations are sometimes tricky to catch. I have already updated the code (bb2da5f3117013876859b27bc9c8338e56199f5a). Please, do let me know if you find something else!

fkohrt commented 1 week ago

Awesome, thanks, now it runs just fine :)