Skip to content

Potential regression with filled areas in ggplot2 3.4.0 #5026

@cpsievert

Description

@cpsievert

I'm not entirely sure if this should be considered a regression, but I noticed this new surprising behavior with geom_area() in the 3.4.0 release candidate:

library(ggplot2)

df <- aggregate(price ~ cut + carat, data = diamonds, FUN = length)
names(df)[3] <- "n"
temp <- aggregate(n ~ carat, data = df, FUN = sum)
names(temp)[2] <- "sum.n"
df <- merge(x = df, y = temp, all.x = TRUE)
df$freq <- df$n / df$sum.n
p <- ggplot(data = df, aes(x = carat, y = freq, fill = cut)) + 
  geom_area()

image

Whereas the ggplot2 3.3.6 release yields:

image

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