Skip to content

Error message "Did you use %>% instead of +?" doesn't show if aes is passed to geom_* #2862

Closed
@EmilHvitfeldt

Description

@EmilHvitfeldt

The recent change to ggplot2 that helps people remember to use + instead of %>% is great! however it doesn't show if you passed aes() to geom_*() instead of ggplot().

library(ggplot2)
library(magrittr)

ggplot(mtcars, aes(mpg, cyl)) %>%
  geom_point()
#> Error: `mapping` must be created by `aes()`
#> Did you use %>% instead of +?

ggplot(mtcars) %>%
  geom_point(aes(mpg, cyl))
#> Error: `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class uneval
#> Did you accidentally pass `aes()` to the `data` argument?

Created on 2018-08-26 by the reprex
package
(v0.2.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions