Skip to content

guide_coloursteps(even.steps = FALSE) works with discrete data #5783

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 7 commits into from
Apr 2, 2024

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #3877.

Briefly, when binning is done outside the scale with cut(), the coloursteps guide understood how to display this, but couldn't display this with uneven steps. This PR makes the guide work with uneven steps.

Reprex from the linked issue:

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

mtcars |>
  transform(mpg_cut = cut(mpg, c(seq(10, 25, 5), 35))) |>
  ggplot(aes(hp, mpg, color = mpg_cut)) +
  geom_point() +
  guides(color = guide_colorsteps(show.limits = TRUE, even.steps = FALSE))

Created on 2024-03-19 with reprex v2.1.0

@thomasp85 mentioned why this was unsupported before here, but I didn't figure out why it was unsupported.

@teunbrand teunbrand added this to the ggplot2 3.5.1 milestone Mar 21, 2024
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.

Well, tbh I can't remember the reason either but it appears I was right in that it had to wait for the guide rewrite 😄

@teunbrand teunbrand merged commit d72caf5 into tidyverse:main Apr 2, 2024
@teunbrand teunbrand deleted the uneven_steps branch April 2, 2024 07:38
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.

even.steps = FALSE does not work when binning is done outside of scale_binned
2 participants