Closed
Description
I'm looking to have control of the color of the box and median independently in geom_boxplot()
. This could be beneficial for light background as well as for dark background themes.
Related questions on stackoverflow have used workarounds that seem somewhat convoluted and case by case.
For example here.
# data
set.seed(1123)
df <- data.frame(matrix(rnorm(100), ncol=2))
names(df) <- c("one", "two")
With base graphics, we can have the plot we are looking for
# base graphics
boxplot(df, medcol="red")
However, we don't have such an easy option to do that in ggplot2
library(ggplot2)
ggplot(reshape2::melt(df),
aes(variable, value))+
geom_boxplot(fatten=3)
# But we have that option for outliers!
ggplot(reshape2::melt(df),
aes(variable, value))+
geom_boxplot(fatten=3, outlier.color = "red")
Having something like median.colour
would be great to solve this issue.