Skip to content

Commit

Permalink
Restore rather than recalculate scales (#6130)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikmart authored Oct 7, 2024
1 parent 4fbc857 commit ad97679
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions R/facet-wrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -447,16 +447,8 @@ FacetWrap <- ggproto("FacetWrap", Facet,

draw_panels = function(self, panels, layout, x_scales, y_scales, ranges, coord, data, theme, params) {
if (inherits(coord, "CoordFlip")) {
if (params$free$x) {
layout$SCALE_X <- seq_len(nrow(layout))
} else {
layout$SCALE_X <- 1L
}
if (params$free$y) {
layout$SCALE_Y <- seq_len(nrow(layout))
} else {
layout$SCALE_Y <- 1L
}
# Switch the scales back
layout[c("SCALE_X", "SCALE_Y")] <- layout[c("SCALE_Y", "SCALE_X")]
}

panel_order <- order(layout$ROW, layout$COL)
Expand Down

0 comments on commit ad97679

Please sign in to comment.