Skip to content

Commit 1c20c94

Browse files
Apply the same fix as #4667 to draw_key_point() (#4938)
1 parent 8d0cef1 commit 1c20c94

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

R/legend-draw.r

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ draw_key_point <- function(data, params, size) {
3030
data$shape <- translate_shape_string(data$shape)
3131
}
3232

33+
# NULL means the default stroke size, and NA means no stroke.
34+
stroke_size <- data$stroke %||% 0.5
35+
stroke_size[is.na(stroke_size)] <- 0
36+
3337
pointsGrob(0.5, 0.5,
3438
pch = data$shape,
3539
gp = gpar(
3640
col = alpha(data$colour %||% "black", data$alpha),
3741
fill = alpha(data$fill %||% "black", data$alpha),
38-
fontsize = (data$size %||% 1.5) * .pt + (data$stroke %||% 0.5) * .stroke / 2,
39-
lwd = (data$stroke %||% 0.5) * .stroke / 2
42+
fontsize = (data$size %||% 1.5) * .pt + stroke_size * .stroke / 2,
43+
lwd = stroke_size * .stroke / 2
4044
)
4145
)
4246
}

0 commit comments

Comments
 (0)