Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ggplot2 (development version)

* Fixed regression with incorrectly drawn gridlines when using `coord_flip()`
(@teunbrand, #6293).
* New parameters for `geom_label()` (@teunbrand and @steveharoz, #5365):
* The `linewidth` aesthetic is now applied and replaces the `label.size`
argument.
Expand Down
6 changes: 5 additions & 1 deletion R/guides-grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ guide_grid <- function(theme, panel_params, coord, square = TRUE) {
y_minor <- setdiff(panel_params$y$mapped_breaks_minor(), y_major)

transform <- if (isTRUE(square)) {
function(x) coord$transform(x, panel_params)
if (inherits(coord, "CoordFlip")) {
function(x) coord$transform(flip_axis_labels(x), panel_params)
} else {
function(x) coord$transform(x, panel_params)
}
} else {
function(x) coord_munch(coord, x, panel_params)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion tests/testthat/test-coord-flip.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ test_that("secondary labels are correctly turned off", {
ggplot(mtcars, aes(x = mpg, y = cyl)) +
geom_point() +
scale_x_continuous(sec.axis = dup_axis(guide = guide_axis(title = NULL))) +
coord_flip()
coord_flip() +
theme_test() +
theme(
panel.grid.major.y = element_line(colour = "grey80"),
panel.grid.major.x = element_line(colour = "grey90")
)
)
})

Expand Down
Loading