Skip to content

Contour removes duplicates #5243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 23, 2023
Merged

Conversation

teunbrand
Copy link
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
Collaborator Author

Should the docs mention what happens to duplicated coordinates?

Copy link
Member

@thomasp85 thomasp85 left a comment

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