Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Bug fixes

* Fixed bug where `stat_bin(boundary)` was ignored (#6682).
* Fixed regression where `draw_key_rect()` stopped using `fill` colours
(@mitchelloharawild, #6609).
* Fixed regression where `scale_{x,y}_*()` threw an error when an expression
Expand Down
7 changes: 6 additions & 1 deletion R/bin.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ bin_breaks_bins <- function(x_range, bins = 30, center = NULL,
} else {
width <- (x_range[2] - x_range[1]) / (bins - 1)
if (is.null(center)) {
boundary <- boundary %||% x_range[1] - width / 2
boundary <- boundary %||% (x_range[1] - width / 2)
}
# If `x_range` coincides with boundary we should
# use exact `bins` instead of `bins - 1` to prevent misalignments.
if (!is.null(boundary) && any(x_range %% width == boundary %% width)) {
width <- (x_range[2] - x_range[1]) / bins
}
}

Expand Down