Skip to content

Conversation

@foo-bar-baz-qux
Copy link
Contributor

Fixes #2110.

This now works:

ggplot(mtcars, aes(y = disp)) + geom_boxplot()

image

Which would essentially be the equivalent of this, without the mapped x-aesthetic:

library(ggplot2)
ggplot(mtcars, aes(x=0, y = disp)) + geom_boxplot()

Tried a few approaches, but this is the cleanest way I've found so far. I think it looks OK to have the x location be at 0 without an axis label; user can always map the x aesthetic if more fine-grained adjustments are required. Ideally, I think the univariate boxplot would look something like this, where the x-axis is essentially removed/treated like a discrete scale. However, I couldn't find a clean way of changing it from a continuous scale from within the geom/stat ggprotos without hard coding the exceptions into the layer building process.

library(ggplot2)
ggplot(mtcars, aes(y = disp, x = "all")) + geom_boxplot()

@hadley
Copy link
Member

hadley commented Oct 30, 2017

Could you please add a test for this too? (Maybe a visual test)

@hadley
Copy link
Member

hadley commented Nov 14, 2017

Are you interested in finishing this off? No problems if you don't have time; just let me know I'll get it over the finish line.

@foo-bar-baz-qux
Copy link
Contributor Author

I'm haven't looked at the visual testing suite so might take some extra time to look through; perhaps you could add that test and finish this off? Thanks.

@hadley hadley merged commit f3abd30 into tidyverse:master Apr 27, 2018
@hadley
Copy link
Member

hadley commented Apr 27, 2018

Looking at the code again, it feels like a visual test would be overkill.

@lock
Copy link

lock bot commented Oct 24, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Oct 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants