Skip to content

Contour removes duplicates - #5243

Merged
teunbrand merged 3 commits into
tidyverse:mainfrom
teunbrand:contour_warn_duplicate
Mar 23, 2023
Merged

teunbrand merged 3 commits into
tidyverse:mainfrom
teunbrand:contour_warn_duplicate

Conversation

@teunbrand

Copy link
Copy Markdown
Collaborator

This PR aims to fix #5215.

Briefly, stat_contour() and stat_contour_filled() will now remove duplicated x,y positions with a warning.

Duplicate values were already implicitly removed here:

ggplot2/R/stat-contour.R

Lines 250 to 251 in 962fb74

raster <- matrix(NA_real_, nrow = nrow, ncol = ncol)
raster[cbind(y_pos, x_pos)] <- data$z

This PR just does it explicitly, compatible with the previous implicit method, and warns the user.

@teunbrand

Copy link
Copy Markdown
Collaborator Author

Should the docs mention what happens to duplicated coordinates?

@thomasp85 thomasp85 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teunbrand
teunbrand merged commit 3cffe34 into tidyverse:main Mar 23, 2023
@teunbrand
teunbrand deleted the contour_warn_duplicate branch March 23, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected behaviour of geom_contour()

2 participants