Skip to content

geom_smooth() warns that weight aesthetic dropped during statistical transformation #5053

Closed
@MattCowgill

Description

@MattCowgill

When using the weight aesthetic with geom_smooth(), I now get the following warning that did not occur before version 3.4.0:

Warning message:
The following aesthetics were dropped during statistical transformation: weight
ℹ This can happen when ggplot fails to infer the correct grouping structure in the data.
ℹ Did you forget to specify a `group` aesthetic or to convert a numerical variable into a factor?

Here is a reprex:

library(ggplot2)

ggplot(mtcars, aes(wt, mpg)) +
  geom_point(aes(size = cyl)) +
  geom_smooth(aes(weight = cyl),
              method = "loess")

I am unclear about why this warning arises. I believe it is related to #4917.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions