Skip to content

Throw error with illigal combination of space in facet_grid and aspect.ratio in theme #4432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 21, 2021
Merged
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
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# ggplot2 (development version)

* Using `theme(aspect.ratio = ...)` together with free space in `facet_grid()`
now crrectly throws an error (@thomasp85, #3834)

* Fix a bug in `stat_summary_bin()` where one more than the requested number of
bins would be created (@thomasp85, #3824)

* Fix a bug in `geom_abline()` that resulted in `intercept` not being subjected
to the transformation of the y scale (@thomasp85, #3741)

* Fix bug in `guide_coloursteps()` that would repeat the terminal bins if the
breaks coincided with the limits of the scale (@thomasp85, #4019)

Expand Down
3 changes: 3 additions & 0 deletions R/facet-grid-.r
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ FacetGrid <- ggproto("FacetGrid", Facet,
strips <- render_strips(col_vars, row_vars, params$labeller, theme)

aspect_ratio <- theme$aspect.ratio
if (!is.null(aspect_ratio) && (params$space_free$x || params$space_free$y)) {
abort("Free scales cannot be mixed with a fixed aspect ratio")
}
if (is.null(aspect_ratio) && !params$free$x && !params$free$y) {
aspect_ratio <- coord$aspect(ranges[[1]])
}
Expand Down