Skip to content

Commit 65662cf

Browse files
authored
Throw error with illigal combination of space in facet_grid and aspect.ratio in theme (#4432)
1 parent 20aa3ed commit 65662cf

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# ggplot2 (development version)
22

3+
* Using `theme(aspect.ratio = ...)` together with free space in `facet_grid()`
4+
now crrectly throws an error (@thomasp85, #3834)
5+
36
* Fix a bug in `stat_summary_bin()` where one more than the requested number of
47
bins would be created (@thomasp85, #3824)
58

69
* Fix a bug in `geom_abline()` that resulted in `intercept` not being subjected
710
to the transformation of the y scale (@thomasp85, #3741)
8-
11+
912
* Fix bug in `guide_coloursteps()` that would repeat the terminal bins if the
1013
breaks coincided with the limits of the scale (@thomasp85, #4019)
1114

R/facet-grid-.r

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ FacetGrid <- ggproto("FacetGrid", Facet,
309309
strips <- render_strips(col_vars, row_vars, params$labeller, theme)
310310

311311
aspect_ratio <- theme$aspect.ratio
312+
if (!is.null(aspect_ratio) && (params$space_free$x || params$space_free$y)) {
313+
abort("Free scales cannot be mixed with a fixed aspect ratio")
314+
}
312315
if (is.null(aspect_ratio) && !params$free$x && !params$free$y) {
313316
aspect_ratio <- coord$aspect(ranges[[1]])
314317
}

0 commit comments

Comments
 (0)