tidyverse / ggplot2

An implementation of the Grammar of Graphics in R

Home Page:https://ggplot2.tidyverse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regression related to #5807

teunbrand opened this issue · comments

Using width = NULL used to work, but it no longer does since we changed it from a parameter to an aesthetic.
Should we just warn + ignore 0-length aesthetics instead of throwing errors?

library(ggplot2)

ggplot(mpg, aes(drv)) +
  geom_bar(width = NULL)

# Load current main branch
devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

ggplot(mpg, aes(drv)) +
  geom_bar(width = NULL)
#> Error in `geom_bar()`:
#> ! Problem while setting up geom aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error in `check_aesthetics()` at ggplot2/R/geom-.R:181:5:
#> ! Aesthetics must be either length 1 or the same as the data (3).
#> ✖ Fix the following mappings: `width`.

Created on 2024-07-19 with reprex v2.1.1