Skip to content

Issue warning when geom orientation is ambiguous #4250

Open
@mine-cetinkaya-rundel

Description

@mine-cetinkaya-rundel

I'm using the new-ish bidirectional geom support to make boxplots stretching along the x-axis. If I place a continuous aesthetic on the y axis, I believe the warning should instead say Continuous y aesthetic. Since I'm not sure how ggplot2 could know my intentions (i.e. whether I want x or y to be considered as the grouping variable), maybe it would be less confusing if the warning said something along the lines of "One of x or y aesthetic should be discrete or you can use aes(group = ...) to specify the grouping variable." Not sure if that's too wordy, but something along those lines would be an improvement on the current warning.

library(tidyverse)
ggplot(mpg, aes(y = displ, x = cty)) +
  geom_boxplot()
#> Warning: Continuous x aesthetic -- did you forget aes(group=...)?

Created on 2020-10-28 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementmessagesrequests for improvements to error, warning, or feedback messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions