Skip to content

Commit fb2e4fe

Browse files
committed
protect against huge amounts of data
1 parent b2d4537 commit fb2e4fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/stat-contour.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ contour_deduplicate <- function(data, check = c("x", "y", "group", "PANEL")) {
400400

401401
estimate_contour_angle <- function(x, y) {
402402

403-
# Compute most frequent angle
404-
all_angles <- atan2(diff(y), diff(x))
403+
# Compute most frequent angle among first 20 points
404+
all_angles <- atan2(diff(head(y, 20L)), diff(head(x, 20L)))
405405
freq <- tabulate(match(all_angles, unique(all_angles)))
406406
i <- which.max(freq)
407407

0 commit comments

Comments
 (0)