tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.48k stars 2.02k forks source link

Fallback for `dir = 'h'/'v'` #5907

Closed teunbrand closed 4 months ago

teunbrand commented 4 months ago

This PR aims to fix #5898 and replaces #5900.

Briefly, it is not as.table that we need to preserve, but old-style dir = 'h'/'v' need to be translated. This PR has a fallback for these old options and soft-deprecates their use.

Developers might see the following in their testthat runs:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2
library(deeptime)

options(lifecycle_verbosity = "warning")

df <- data.frame(x = 1:10, y = 1:10, period = c("Permian", "Triassic"))
ggplot(df) +
  geom_point(aes(x, y)) +
  facet_wrap_color(vars(period), colors = periods)
#> Warning: Internal use of `dir = "h"` and `dir = "v"` in `facet_wrap()` was deprecated in
#> ggplot2 3.5.2.
#> ℹ The `dir` argument should incorporate the `as.table` argument.
#> ℹ Falling back to `dir = "lt"`.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

Created on 2024-05-24 with reprex v2.1.0