ggplot2
ggplot2 copied to clipboard
Only use finite breaks for computing fuzz
This PR aims to fix #5665.
Briefly, when histogram breaks
are short and contain non-finite values, the median difference between breaks can become Inf
.
In this PR, we only use finite breaks to compute the median difference for the fuzz-factor.
Reprex from #5665
devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2
data <- data.frame(x = c(rep(1, 10), 5))
ggplot(data, aes(x)) +
geom_histogram(
breaks = c(-Inf, 2, 6, Inf),
closed = "left"
)
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_bar()`).
Created on 2024-01-30 with reprex v2.1.0