Closed
Description
Failure to check aesthetics for geoms that use setup_data
can cause cryptic error messages:
ggplot(iris) + geom_col()
## Error in pmin(y, 0) : object 'y' not found
## In addition: Warning messages:
## 1: In min(x, na.rm = na.rm) :
## no non-missing arguments to min; returning Inf
## 2: In max(x, na.rm = na.rm) :
## no non-missing arguments to max; returning -Inf
## 3: In min(diff(sort(x))) : no non-missing arguments to min; returning Inf
Compare to:
ggplot(iris) + geom_point()
## Error: geom_point requires the following missing aesthetics: x, y
This is because in Layer$compute_geom_1
we setup_data
before we check_required_aesthetics
.
I can definitely see the rationale for this if it is the case that some required aesthetics are generated by setup_data
, which I guess is possible but seems a bit odd. After all, why would we require an aesthetic that would be auto generated?
The change is in theory trivial, but I can imagine it is possible there would be unintended consequences. I can make the change, test to see if anything breaks, and so on, but probably not in the next couple of weeks. If you're interested let me know and I'll work on a PR for the next release.
Metadata
Metadata
Assignees
Labels
No labels