Skip to content

Allow independent color modification of median in boxplot #3459

Closed

Description

@matiasandina

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.

Activity

  1. added
    feature
    on Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurelayers 📈

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions