-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
The move from 3.5.2 to 4.0.0 seems to introduce a bug that ignores boundary settings in geom_histogram(). Reprexes below.
Reprex using CRAN's 4.0.0
library("ggplot2")
sessionInfo()$otherPkgs$ggplot2$Version
#> [1] "4.0.0"
set.seed(1234)
df <- data.frame(x = abs(rnorm(1e4)))
# histogram of exponential data, notice first bin crosses 0 (all data is > 0)
ggplot(df, aes(x)) +
geom_histogram(bins = 101)
# setting boundary = 0, but no change
ggplot(df, aes(x)) +
geom_histogram(bins = 101, boundary = 0)
# zooming in on 0-boundary crossover
ggplot(df, aes(x)) +
geom_histogram(bins = 101, boundary = 0) +
coord_cartesian(xlim = c(-.2, .5))
Reprex using CRAN's 3.5.2
library("ggplot2")
sessionInfo()$otherPkgs$ggplot2$Version
#> [1] "3.5.2"
set.seed(1234)
df <- data.frame(x = abs(rnorm(1e4)))
# histogram of exponential data, notice first bin crosses 0 (all data is > 0)
ggplot(df, aes(x)) +
geom_histogram(bins = 101)
# setting boundary = 0, which *does* show change
ggplot(df, aes(x)) +
geom_histogram(bins = 101, boundary = 0)
# zooming in on 0-boundary crossover
ggplot(df, aes(x)) +
geom_histogram(bins = 101, boundary = 0) +
coord_cartesian(xlim = c(-.2, .5))