Skip to content

Dotplots with discrete y #5463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 14, 2023
Merged

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5462.

Briefly, it brings the behaviour of swapping x and y in geom_dotplot() closer to what coord_flip() does.

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

swapped <- ggplot(data = iris) +
  geom_dotplot(aes(x = Sepal.Length, y = Species), binaxis = "x") +
  ggtitle("Swapped aesthetics")

flipped <- ggplot(data = iris) +
  geom_dotplot(aes(x = Species, y = Sepal.Length), binaxis = "y") +
  coord_flip() +
  ggtitle("With `coord_flip()`")

library(patchwork)
swapped + flipped
#> Bin width defaults to 1/30 of the range of the data. Pick better value with
#> `binwidth`.
#> Bin width defaults to 1/30 of the range of the data. Pick better value with
#> `binwidth`.

Created on 2023-10-09 with reprex v2.0.2

Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thomasp85 thomasp85 added this to the ggplot2 3.5.0 milestone Dec 14, 2023
@teunbrand teunbrand merged commit 4d7e202 into tidyverse:main Dec 14, 2023
@teunbrand teunbrand deleted the dotplot_discrete_y branch December 14, 2023 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

geom_dotplot() with continuous x variable and a categorical y variable.
2 participants