Skip to content

Commit 69dfc4b

Browse files
clauswilkehadley
authored andcommitted
CoordSf needs to define its own is_free() function. Closes #2651. (#2652)
1 parent eecc450 commit 69dfc4b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

R/coord-.r

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ Coord <- ggproto("Coord",
8787

8888
is_linear = function() FALSE,
8989

90+
# Does the coordinate system support free scaling of axes in a faceted plot?
91+
# Will generally have to return FALSE for coordinate systems that enforce a fixed aspect ratio.
9092
is_free = function() FALSE,
9193

9294
setup_params = function(data) {

R/sf.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
353353
)
354354
},
355355

356+
# CoordSf enforces a fixed aspect ratio -> axes cannot be changed freely under faceting
357+
is_free = function() FALSE,
358+
356359
aspect = function(self, panel_params) {
357360
if (isTRUE(sf::st_is_longlat(panel_params$crs))) {
358361
# Contributed by @edzer

0 commit comments

Comments
 (0)