@@ -93,8 +93,8 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
93
93
# transform and normalize regular position data
94
94
data <- transform_position(
95
95
sf_transform_xy(data , target_crs , source_crs ),
96
- function (x ) sf_rescale01_x (x , panel_params $ x_range ),
97
- function (x ) sf_rescale01_x (x , panel_params $ y_range )
96
+ function (x ) rescale (x , from = panel_params $ x_range ),
97
+ function (x ) rescale (x , from = panel_params $ y_range )
98
98
)
99
99
100
100
transform_position(data , squish_infinite , squish_infinite )
@@ -250,10 +250,10 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
250
250
251
251
# Rescale graticule for panel grid
252
252
sf :: st_geometry(graticule ) <- sf_rescale01(sf :: st_geometry(graticule ), x_range , y_range )
253
- graticule $ x_start <- sf_rescale01_x (graticule $ x_start , x_range )
254
- graticule $ x_end <- sf_rescale01_x (graticule $ x_end , x_range )
255
- graticule $ y_start <- sf_rescale01_x (graticule $ y_start , y_range )
256
- graticule $ y_end <- sf_rescale01_x (graticule $ y_end , y_range )
253
+ graticule $ x_start <- rescale (graticule $ x_start , from = x_range )
254
+ graticule $ x_end <- rescale (graticule $ x_end , from = x_range )
255
+ graticule $ y_start <- rescale (graticule $ y_start , from = y_range )
256
+ graticule $ y_end <- rescale (graticule $ y_end , from = y_range )
257
257
258
258
list2(
259
259
x_range = x_range ,
@@ -405,11 +405,6 @@ sf_rescale01 <- function(x, x_range, y_range) {
405
405
sf :: st_normalize(x , c(x_range [1 ], y_range [1 ], x_range [2 ], y_range [2 ]))
406
406
}
407
407
408
- # normalize position data (variable x is x or y position)
409
- sf_rescale01_x <- function (x , range ) {
410
- (x - range [1 ]) / diff(range )
411
- }
412
-
413
408
# different limits methods
414
409
calc_limits_bbox <- function (method , xlim , ylim , crs , default_crs ) {
415
410
if (any(! is.finite(c(xlim , ylim ))) && method != " geometry_bbox" ) {
0 commit comments