Skip to content

geom_boxplot() with data rows >1 and stat = "identity" fails #3316

Closed
@paleolimbot

Description

@paleolimbot

In the revdep checks (#3303) at least one plot in an example failed to build that used geom_boxplot(stat = "identity") with more than one data row.

library(ggplot2)
ggplot(
  data.frame(x = "one value", y = 3, value = 4:6),
  aes(x, ymin = 0, lower = 1, middle = y, upper = value, ymax = 10)
) + 
  geom_boxplot(stat = "identity", position = "identity")
#> Error: Elements must equal the number of rows or 1

In 3.1.1, this works as expected (position dodge would make more sense here, but I wanted to make sure this wasn't the issue).

library(ggplot2)
ggplot(
  data.frame(x = "one value", y = 3, value = 4:6),
  aes(x, ymin = 0, lower = 1, middle = y, upper = value, ymax = 10)
) + 
  geom_boxplot(stat = "identity", position = "identity")

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