Skip to content

Commit e1d3de5

Browse files
committed
I think this is the final edition -_-!
1 parent 465f623 commit e1d3de5

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

R/geom-sf.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,10 @@ geom_sf <- function(mapping = aes(), data = NULL, stat = "sf",
197197
mapping = mapping,
198198
stat = stat,
199199
position = position,
200-
#show.legend = if (is.character(show.legend)) TRUE else show.legend,
201200
show.legend = show.legend,
202201
inherit.aes = inherit.aes,
203202
params = list(
204203
na.rm = na.rm,
205-
#legend = if (is.character(show.legend)) show.legend else "polygon",
206204
...
207205
)
208206
),

R/layer-sf.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ LayerSf <- ggproto("LayerSf", Layer,
3939
# automatically determine the legend type
4040
if (is.na(self$show.legend) || isTRUE(self$show.legend)) {
4141
if (is_sf(data)) {
42-
geometry_type <- sf_geometry_type(data)
43-
if (sf_types[geometry_type] == "point")
42+
sf_type <- detect_sf_type(data)
43+
if (sf_type == "point")
4444
self$geom_params$legend <- "point"
45-
else if (sf_types[geometry_type] == "line")
45+
else if (sf_type == "line")
4646
self$geom_params$legend <- "line"
4747
else self$geom_params$legend <- "polygon"
4848
}
@@ -78,8 +78,8 @@ is_sf <- function(data) {
7878
scale_type.sfc <- function(x) "identity"
7979

8080
# helper function to determine the geometry type of sf object
81-
sf_geometry_type <- function(sf) {
81+
detect_sf_type <- function(sf) {
8282
geometry_type <- unique(as.character(sf::st_geometry_type(sf)))
8383
if (length(geometry_type) != 1) geometry_type <- "GEOMETRY"
84-
geometry_type
84+
sf_types[geometry_type]
8585
}

R/stat-sf.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ stat_sf <- function(mapping = NULL, data = NULL, geom = "rect",
2828
mapping = mapping,
2929
geom = geom,
3030
position = position,
31-
#show.legend = if (is.character(show.legend)) TRUE else show.legend,
3231
show.legend = show.legend,
3332
inherit.aes = inherit.aes,
3433
params = list(
3534
na.rm = na.rm,
36-
#legend = if (is.character(show.legend)) show.legend else "polygon",
3735
...
3836
)
3937
)

0 commit comments

Comments
 (0)