Skip to content

Commit 4d2333a

Browse files
authored
treat stroke == NA as 0 (#4667)
1 parent 0a6927f commit 4d2333a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ggplot2 (development version)
22

3+
* Setting `stroke` to `NA` in `geom_point()` will no longer impair the sizing of
4+
the points (@thomasp85, #4624)
5+
36
* `stat_bin_2d()` now correctly recognises the `weight` aesthetic
47
(@thomasp85, #4646)
58

R/geom-point.r

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ GeomPoint <- ggproto("GeomPoint", Geom,
122122
}
123123

124124
coords <- coord$transform(data, panel_params)
125+
stroke_size <- coords$stroke
126+
stroke_size[is.na(stroke_size)] <- 0
125127
ggname("geom_point",
126128
pointsGrob(
127129
coords$x, coords$y,
@@ -130,7 +132,7 @@ GeomPoint <- ggproto("GeomPoint", Geom,
130132
col = alpha(coords$colour, coords$alpha),
131133
fill = alpha(coords$fill, coords$alpha),
132134
# Stroke is added around the outside of the point
133-
fontsize = coords$size * .pt + coords$stroke * .stroke / 2,
135+
fontsize = coords$size * .pt + stroke_size * .stroke / 2,
134136
lwd = coords$stroke * .stroke / 2
135137
)
136138
)

0 commit comments

Comments
 (0)