Skip to content

geom_ribbon() now errors when ymin and ymax aesthetics are set rather than mapped #3318

Closed
@paleolimbot

Description

@paleolimbot

This was identified in the revdep checks (#3303), as it breaks a plot in bayesAB. This error was introduced on purpose (#3235). It's worth noting that the behaviour of layers when all the required aesthetics are set and not mapped is undefined and not consistent between geometries. See #3303 (comment) , #3235 (comment) , and #3303 (comment) .

library(ggplot2)
ggplot() + 
  geom_ribbon(x = 1:5, ymin = 0, ymax = 1:5, data = data.frame(1:5)) +
  geom_blank(aes(x = 1:5, y = 1:5))
#> Error: Either ymin or ymax must be given as an aesthetic.

Whereas in 3.1.1:

library(ggplot2)
ggplot() + 
  geom_ribbon(x = 1:5, ymin = 0, ymax = 1:5, data = data.frame(1:5)) +
  geom_blank(aes(x = 1:5, y = 1:5))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions