-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Unexpected warning when plotting geom_map() #3454
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
Comments
I think the problem is that Lines 118 to 122 in d1ecd03
|
I don't know well about For example, if the data doesn't have a column named library(ggplot2)
wr <- map_data("world")
wr <- dplyr::rename(wr, lon = long)
ggplot() +
geom_map(aes(lat, lon, map_id = region), map = wr, data = wr2)
#> Error in geom_map(aes(lat, lon, map_id = region), map = wr, data = wr2): all(c("x", "y", "id") %in% names(map)) is not TRUE Created on 2019-08-19 by the reprex package (v0.3.0) |
Now that we have |
I don't understand this issue. Reading the documentation of The correct way to set the limits is via library(ggplot2)
wr <- map_data("world")
ggplot() +
geom_map(aes(map_id = region), map = wr, data = wr) +
expand_limits(x = wr$long, y = wr$lat) Created on 2019-12-19 by the reprex package (v0.3.0) |
Yes, the warning is definitely correct. I meant adding some check like below might help the user find what they should do. ignoring_aes <- intersect(names(mapping), c("x", "y", "group"))
if (length(ignoring_aes) > 0) {
warn(glue("geom_map() doesn't accept mapping of `x`, `y`, or `group`, ",
"but expects the data has fixed names of columns `x`, `y` and `id`."))
} What do you think? I'm OK to close this issue if there's no chance to improve the warning than simple |
My concern about the warning is that the warning needs to be evaluated on the specific combination of geom and stat. Are there cases where somebody uses It seems to me that it would be more important to improve the documentation of |
Sorry, I forgot to reply here. Thanks, agreed. I didn't think of the case...
Sounds good. I've been wondered the status of |
I'm closing this in favour of #3721 |
reprex
:The text was updated successfully, but these errors were encountered: