Skip to content

Boxplot color can't have a continuous variable when faceting #6395

Closed
@JacobBumgarner

Description

@JacobBumgarner

Code

For some reason the boxplot layer isn't able to have a continuous variable (other than the one used to define the group, e.g., x in the plot below):

ggplot2::ggplot(
    mtcars,
    ggplot2::aes(x = factor(cyl), y = hp, color = hp)
) + 
    ggplot2::geom_point() + 
    ggplot2::geom_boxplot(outliers = FALSE) + 
    ggplot2::facet_wrap(gear ~ am)

Image

Warning on plot

> ggplot2::ggplot(
+     mtcars,
+     ggplot2::aes(x = factor(cyl), y = hp, color = hp)
+ ) + 
+     ggplot2::geom_point() + 
+     ggplot2::geom_boxplot(outliers = FALSE) + 
+     ggplot2::facet_wrap(gear ~ am)
Warning: The following aesthetics were dropped during statistical transformation: colour.
ℹ This can happen when ggplot fails to infer the correct grouping structure in the data.
ℹ Did you forget to specify a `group` aesthetic or to convert a numerical variable into
  a factor?
Warning: The following aesthetics were dropped during statistical transformation: colour.
ℹ This can happen when ggplot fails to infer the correct grouping structure in the data.
ℹ Did you forget to specify a `group` aesthetic or to convert a numerical variable into
  a factor?
Warning: The following aesthetics were dropped during statistical transformation: colour.
ℹ This can happen when ggplot fails to infer the correct grouping structure in the data.
ℹ Did you forget to specify a `group` aesthetic or to convert a numerical variable into
  a factor?
Warning: The following aesthetics were dropped during statistical transformation: colour.
ℹ This can happen when ggplot fails to infer the correct grouping structure in the data.
ℹ Did you forget to specify a `group` aesthetic or to convert a numerical variable into
  a factor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions