@@ -77,6 +77,10 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
77
77
},
78
78
79
79
transform = function (self , data , panel_params ) {
80
+ if (is_transform_immune(data , snake_class(self ))) {
81
+ return (data )
82
+ }
83
+
80
84
# we need to transform all non-sf data into the correct coordinate system
81
85
source_crs <- panel_params $ default_crs
82
86
target_crs <- panel_params $ crs
@@ -108,7 +112,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
108
112
x_breaks <- graticule $ degree [graticule $ type == " E" ]
109
113
if (is.null(scale_x $ labels )) {
110
114
x_labels <- rep(NA , length(x_breaks ))
111
- } else if (is.waive (scale_x $ labels )) {
115
+ } else if (is.waiver (scale_x $ labels )) {
112
116
x_labels <- graticule $ degree_label [graticule $ type == " E" ]
113
117
needs_autoparsing [graticule $ type == " E" ] <- TRUE
114
118
} else {
@@ -133,7 +137,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
133
137
y_breaks <- graticule $ degree [graticule $ type == " N" ]
134
138
if (is.null(scale_y $ labels )) {
135
139
y_labels <- rep(NA , length(y_breaks ))
136
- } else if (is.waive (scale_y $ labels )) {
140
+ } else if (is.waiver (scale_y $ labels )) {
137
141
y_labels <- graticule $ degree_label [graticule $ type == " N" ]
138
142
needs_autoparsing [graticule $ type == " N" ] <- TRUE
139
143
} else {
@@ -534,7 +538,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE,
534
538
label_axes = waiver(), lims_method = " cross" ,
535
539
ndiscr = 100 , default = FALSE , clip = " on" ) {
536
540
537
- if (is.waive (label_graticule ) && is.waive (label_axes )) {
541
+ if (is.waiver (label_graticule ) && is.waiver (label_axes )) {
538
542
# if both `label_graticule` and `label_axes` are set to waive then we
539
543
# use the default of labels on the left and at the bottom
540
544
label_graticule <- " "
@@ -620,13 +624,13 @@ sf_breaks <- function(scale_x, scale_y, bbox, crs) {
620
624
bbox [is.na(bbox )] <- c(- 180 , - 90 , 180 , 90 )[is.na(bbox )]
621
625
}
622
626
623
- if (! (is.waive (scale_x $ breaks ) && is.null(scale_x $ n.breaks ))) {
627
+ if (! (is.waiver (scale_x $ breaks ) && is.null(scale_x $ n.breaks ))) {
624
628
x_breaks <- scale_x $ get_breaks(limits = bbox [c(1 , 3 )])
625
629
finite <- is.finite(x_breaks )
626
630
x_breaks <- if (any(finite )) x_breaks [finite ] else NULL
627
631
}
628
632
629
- if (! (is.waive (scale_y $ breaks ) && is.null(scale_y $ n.breaks ))) {
633
+ if (! (is.waiver (scale_y $ breaks ) && is.null(scale_y $ n.breaks ))) {
630
634
y_breaks <- scale_y $ get_breaks(limits = bbox [c(2 , 4 )])
631
635
finite <- is.finite(y_breaks )
632
636
y_breaks <- if (any(finite )) y_breaks [finite ] else NULL
@@ -657,6 +661,9 @@ sf_breaks <- function(scale_x, scale_y, bbox, crs) {
657
661
# ' @keywords internal
658
662
view_scales_from_graticule <- function (graticule , scale , aesthetic ,
659
663
label , label_graticule , bbox ) {
664
+ if (empty(graticule )) {
665
+ return (ggproto(NULL , ViewScale ))
666
+ }
660
667
661
668
# Setup position specific parameters
662
669
# Note that top/bottom doesn't necessarily mean to label the meridians and
0 commit comments