Skip to content

Commit 3667737

Browse files
committed
ensure radius column in present
1 parent 4e1f661 commit 3667737

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

R/geom-hex.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ GeomHex <- ggproto("GeomHex", Geom,
2828
n <- nrow(data)
2929
hexC <- hexbin::hexcoords(dx, dy, n = n)
3030

31-
hexdata <- vec_rep_each(data[c("x", "y", "radius")], times = 6L)
31+
columns <- intersect(c("x", "y", "radius"), names(data))
32+
hexdata <- vec_rep_each(data[columns], times = 6L)
33+
hexdata$radius <- hexdata$radius %||% 1
3234
hexdata$x <- hexC$x * hexdata$radius + hexdata$x
3335
hexdata$y <- hexC$y * hexdata$radius + hexdata$y
3436

0 commit comments

Comments
 (0)