Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow independent color modification of median in boxplot #3459

Closed
matiasandina opened this issue Jul 26, 2019 · 0 comments · Fixed by #5423
Closed

Allow independent color modification of median in boxplot #3459

matiasandina opened this issue Jul 26, 2019 · 0 comments · Fixed by #5423
Labels
feature a feature request or enhancement layers 📈

Comments

@matiasandina
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement layers 📈
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants