Skip to content

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5066.

Briefly, when the default limits of binned scales have zero-width, they are expanded to have 0.1 width (the same as default_expansion()).

Reprexes from the linked issue:

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

data.frame(x = c("a", "b"), 
           y = c("A", "B")) |> 
  ggplot() + 
  geom_bin_2d(aes(x = x, y = y)) + 
  scale_fill_binned()

ggplot(data.frame(x=1), aes(x=x)) + geom_bar() + scale_x_binned()

Created on 2024-12-10 with reprex v2.1.1

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

@teunbrand teunbrand merged commit e30642b into tidyverse:main Jan 27, 2025
13 checks passed
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.

scale_fill_binned throws error if all bins have the same value
2 participants