Add warning when raster data doesn't fall on an even grid#3256
Add warning when raster data doesn't fall on an even grid#3256thomasp85 merged 2 commits intotidyverse:masterfrom
Conversation
|
On first glance the code looks good to me but since the visual tests fail maybe there are some unanticipated side effects? The one difference I see between |
|
And also please make sure things behave in a reasonable way when the data vector contains only a single unique value. Not sure if that's the case right now or not. At a minimum, the warning in that case seems confusing. |
R/geom-raster.r
Outdated
| w <- resolution(data$x, FALSE) | ||
| h <- resolution(data$y, FALSE) | ||
| x_diff <- diff(sort(unique(data$x))) | ||
| if (!length(unique(x_diff)) == 1) { |
There was a problem hiding this comment.
I think this assumption is too strong. For example:
unique(diff(1:10 / 10))
#> [1] 0.1 0.1 0.1 0.1Created on 2019-04-24 by the reprex package (v0.2.1)
We need a version of unique() with tolerance.
|
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
Fixes #2932
This adds a warning when
geom_raster()can't truthfully represent the provided data. To avoid recompilation the call toresolution()has been changed to direct calculation.@batpigandme can you have a look at the wording of the warning?