teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
534 stars 32 forks source link

Double color Boxplot #105

Closed brunomioto closed 1 year ago

brunomioto commented 1 year ago

Is it possible to create it without combining a lot of geoms? I liked Cedric idea

https://twitter.com/CedScherer/status/1643557524996603905?t=1fs-xvr4YfccV2EGJosZKg&s=19

teunbrand commented 1 year ago

Not a situation where I can reprex easily but you should be able to do:

library(ggplot2)

ggplot(iris, aes(Species, Sepal.Width)) +
  geom_boxplot(colour = "red", fill = "red", alpha = 0.3,
               aes(ymin = after_stat(middle), lower = after_stat(middle))) +
  geom_boxplot(colour = "green", fill = "green", alpha = 0.3,
               aes(ymax = after_stat(middle), upper = after_stat(middle)))

But there is no way I'm adding this to ggh4x :sweat_smile: