Sayani07 / gghdr

Plots of highest density regions (HDR) for ggplot2
https://sayani07.github.io/gghdr/
GNU General Public License v3.0
47 stars 5 forks source link

fill color doesn't match up with legend key #15

Closed emitanaka closed 2 years ago

emitanaka commented 4 years ago

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

mitchelloharawild commented 4 years ago

I think of the legend for level here as more of a shade rather than fill colour. If anything, the default fill colour for the box should be grayscale.

The grayscale colour scheme is for the legend to make sense when the fill varies in the plot.

On Thu., 20 Feb. 2020, 08:13 Emi Tanaka, notifications@github.com wrote:

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()

[image: download] https://user-images.githubusercontent.com/7620319/74885409-9154b100-53c9-11ea-88e5-6a90fb7ab0a7.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ropenscilabs/gghdr/issues/15?email_source=notifications&email_token=AD3BJFZVV3LV7WSCSC4KR43RDW4IXA5CNFSM4KYDRVMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IOZVBCA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3BJF4BLE3FWJAIQCVMBCLRDW4IXANCNFSM4KYDRVMA .

emitanaka commented 4 years ago

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

mitchelloharawild commented 4 years ago

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

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

thomas-fung commented 4 years ago

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.