@@ -77,6 +77,10 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
7777 },
7878
7979 transform = function (self , data , panel_params ) {
80+ if (is_transform_immune(data , snake_class(self ))) {
81+ return (data )
82+ }
83+
8084 # we need to transform all non-sf data into the correct coordinate system
8185 source_crs <- panel_params $ default_crs
8286 target_crs <- panel_params $ crs
@@ -108,7 +112,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
108112 x_breaks <- graticule $ degree [graticule $ type == " E" ]
109113 if (is.null(scale_x $ labels )) {
110114 x_labels <- rep(NA , length(x_breaks ))
111- } else if (is.waive (scale_x $ labels )) {
115+ } else if (is.waiver (scale_x $ labels )) {
112116 x_labels <- graticule $ degree_label [graticule $ type == " E" ]
113117 needs_autoparsing [graticule $ type == " E" ] <- TRUE
114118 } else {
@@ -133,7 +137,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
133137 y_breaks <- graticule $ degree [graticule $ type == " N" ]
134138 if (is.null(scale_y $ labels )) {
135139 y_labels <- rep(NA , length(y_breaks ))
136- } else if (is.waive (scale_y $ labels )) {
140+ } else if (is.waiver (scale_y $ labels )) {
137141 y_labels <- graticule $ degree_label [graticule $ type == " N" ]
138142 needs_autoparsing [graticule $ type == " N" ] <- TRUE
139143 } else {
@@ -534,7 +538,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE,
534538 label_axes = waiver(), lims_method = " cross" ,
535539 ndiscr = 100 , default = FALSE , clip = " on" ) {
536540
537- if (is.waive (label_graticule ) && is.waive (label_axes )) {
541+ if (is.waiver (label_graticule ) && is.waiver (label_axes )) {
538542 # if both `label_graticule` and `label_axes` are set to waive then we
539543 # use the default of labels on the left and at the bottom
540544 label_graticule <- " "
@@ -620,13 +624,13 @@ sf_breaks <- function(scale_x, scale_y, bbox, crs) {
620624 bbox [is.na(bbox )] <- c(- 180 , - 90 , 180 , 90 )[is.na(bbox )]
621625 }
622626
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 ))) {
624628 x_breaks <- scale_x $ get_breaks(limits = bbox [c(1 , 3 )])
625629 finite <- is.finite(x_breaks )
626630 x_breaks <- if (any(finite )) x_breaks [finite ] else NULL
627631 }
628632
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 ))) {
630634 y_breaks <- scale_y $ get_breaks(limits = bbox [c(2 , 4 )])
631635 finite <- is.finite(y_breaks )
632636 y_breaks <- if (any(finite )) y_breaks [finite ] else NULL
@@ -657,6 +661,9 @@ sf_breaks <- function(scale_x, scale_y, bbox, crs) {
657661# ' @keywords internal
658662view_scales_from_graticule <- function (graticule , scale , aesthetic ,
659663 label , label_graticule , bbox ) {
664+ if (empty(graticule )) {
665+ return (ggproto(NULL , ViewScale ))
666+ }
660667
661668 # Setup position specific parameters
662669 # Note that top/bottom doesn't necessarily mean to label the meridians and
0 commit comments