Skip to content

Commit e789017

Browse files
committed
defend against character linetypes
1 parent ec33079 commit e789017

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

R/geom-sf.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ GeomSf <- ggproto("GeomSf", Geom,
161161
vec_slice(data, index$point),
162162
params, modifiers, theme = theme
163163
)
164-
points$linetype <- 1L # Avoids NA linetype, which is invalid input
165164
}
166165
if (length(index$line) > 0) {
167166
lines <- GeomLine$use_defaults(
@@ -201,6 +200,10 @@ GeomSf <- ggproto("GeomSf", Geom,
201200

202201
# Recombine data in original order
203202
data <- vec_c(points, lines, others, collections)
203+
# Avoids NA linetype in points, which is invalid input
204+
data$linetype[vec_seq_along(points)] <-
205+
if (is.character(data$linetype)) "solid" else 1L
206+
204207
vec_slice(data, order(unlist(index)))
205208
},
206209

0 commit comments

Comments
 (0)