Skip to content

Commit eb91826

Browse files
authored
Flip labels input before modifying them (#4441)
1 parent 333ae5c commit eb91826

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

R/coord-flip.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ CoordFlip <- ggproto("CoordFlip", CoordCartesian,
6262
},
6363

6464
labels = function(labels, panel_params) {
65-
flip_axis_labels(CoordCartesian$labels(labels, panel_params))
65+
CoordCartesian$labels(flip_axis_labels(labels), panel_params)
6666
},
6767

6868
setup_layout = function(layout, params) {
Lines changed: 97 additions & 0 deletions
Loading

tests/testthat/test-coord-flip.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
context("test-coord-flip.r")
2+
3+
test_that("secondary labels are correctly turned off", {
4+
# Using a visual test because the labels are only generated during rendering
5+
expect_doppelganger("turning off secondary title with coord_flip",
6+
ggplot(mtcars, aes(x = mpg, y = cyl)) +
7+
geom_point() +
8+
scale_x_continuous(sec.axis = dup_axis(guide = guide_axis(title = NULL))) +
9+
coord_flip()
10+
)
11+
})

0 commit comments

Comments
 (0)