Skip to content

Commit a9e1fc0

Browse files
committed
incorporate suggested changes by yutannihilation
1 parent 2a03f02 commit a9e1fc0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

R/sf.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,16 @@ LayerSf <- ggproto("LayerSf", Layer,
153153
# and add the mapping if it doesn't exist
154154
data <- self$layer_data(plot$data)
155155

156-
if (!is.null(data) && is_sf(data)) {
157-
geometry_col <- attr(data, "sf_column")
158-
} else {
159-
geometry_col <- "geometry"
160-
}
161-
162156
if ((isTRUE(self$inherit.aes) && is.null(self$mapping$geometry) && is.null(plot$mapping$geometry)) ||
163157
(!isTRUE(self$inherit.aes) && is.null(self$mapping$geometry))) {
164-
self$mapping$geometry <- as.name(geometry_col)
158+
if (!is.waive(data) && is_sf(data)) {
159+
geometry_col <- attr(data, "sf_column")
160+
self$mapping$geometry <- as.name(geometry_col)
161+
}
165162
}
163+
164+
# call parent for generic layer setup
165+
ggproto_parent(Layer, self)$setup_layer(plot)
166166
}
167167
)
168168

0 commit comments

Comments
 (0)