You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> 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?
The text was updated successfully, but these errors were encountered:
The issue arises because multiple colors are being assigned within each boxplot group, whereas each box should have a single, consistent color. To resolve this, you can summarize the color per group — for example, using the mean (or median) of hp for each group:
This is indeed because you're giving instructions to give singular boxplots multiple colour values. The warning message indicates that there might be a conflict between the colour aesthetic and grouping structure. In your mind, what'd be the ideal outcome in this problem?
I see - sorry for the confusion, and thanks for the explanation @Yunuuuu
@teunbrand I believe I was imagining the color value would automatically have taken an average of the grouped values. But after thinking about this, I realize how big of an assumption this is.
I think this was after a long night of coding, so I was assuming very poorly... please disregard!!
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):Warning on plot
The text was updated successfully, but these errors were encountered: