Sayani07/gghdr

fill color doesn't match up with legend key

Closed this issue · 4 comments

In below example the legend key doesn't have the same fill color.

library(gghdr)
library(ggplot2)
ggplot(faithful, aes(y = eruptions)) + 
  geom_hdr_boxplot(prob = c(.5, 0.99), fill = "blue") + 
  theme_minimal()

download

I guess here's what you mean about the shading:
download (1)
Slightly awkward for single color case above but understandable for above case.

I don't feel strongly about the single colour case, but my two reasons not to do it are:

  • Inconsistency
  • I think it's hard 🙈

If you wanted to try, feel free. I think Rob has some stronger opinions about the single colour case.

In an earlier attempt, it was possible to match the legend key and (most of) the fill colour. Obviously the code would need to be flexible enough to allow an arbitrary number of shades and the way we did it was to scale a particular attribute of a colouring system to create different level of shades. But it would fall apart if the fill colour has a low or zero value for such attribute such as "black". We can obviously manage these cases but it would create inconsistency just like Mitch said.