Skip to content

breaking change: alpha now impacts the line of stat_ based geoms. #1523

Closed
@antoine-lizee

Description

@antoine-lizee

This has changed following #1371, and I think (personally) that this is the wrong decision.
Pros: it's slightly more 'natural' to have alpha impacting both the line and fill (?)
Cons: the line texture is modified by the alpha parameter in a way that is irreversible, and thus you need a different geom for the common use case (to me) of having a solid line with a transparent filling.
Here is an example:

ggplot(diamonds %>% filter(cut %in% c("Very Good", "Ideal")), aes(x = price, fill = cut)) + theme_bw() + 
  geom_histogram(binwidth = 1000) +
  geom_density(aes(x = price, y = ..count.. * 1000), color = "NA", alpha = 0.3) +
  geom_density(aes(x = price, y = ..count.. * 1000), color = "black", fill = NA) +
  facet_grid(cut ~ ., scales = "free_y", space = "free_y")

I would vote for reverting this behavior, as I'm pretty sure it's breaking more graphing code now than it would if reverted for 2.1.

The downside of the old behavior is that you need to change the color directly if you want something lighter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions