-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Cannot remove panel.grid (graticules) from ggplot + geom_sf() #2071
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
Looks like a bug. One trick I discovered to solve this is to set the color of the I call this a bug because |
Another use-case where it's important not to have the graticule is when the crs is NA. Currently there's a test for identical(sf::NA_crs_, crs) I started a PR but can't test the outcome of this fix fully since the graticule logic doesn't work. An example is nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
nc_na <- sf::st_set_crs(nc, NA)
ggplot(nc_na) + coord_sf()
#Error in if (st_is_longlat(crs)) bb = trim_bb(bb, margin) :
# missing value where TRUE/FALSE needed
It's an error from sf but presume ggplot2 would like to be robust against this anyway (setting CRS to NA is required to avoid ellipsoid geometry logic in Happy to help explore more and create examples if that helps but the overall solution is beyond me atm. |
@LucasPuente or perhaps |
when giving coord_sf(..., datum = NA)
r-spatial/sf@812cdff now removes the need to patch ggplot2. |
Note that the solution provided above will not hide the graticules if |
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/ |
I would like to completely remove the graticule lines from my plot, but it is unclear which argument in
theme()
controls the graticule lines.Reprex
The text was updated successfully, but these errors were encountered: