Skip to content

sf graticules are drawn even if relevant theme elements are set to element_blank() #2525

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

Closed
karldw opened this issue Apr 16, 2018 · 4 comments

Comments

@karldw
Copy link

karldw commented Apr 16, 2018

theme_void() is a great way to clear out all the extra lines in a chart. My intuition was that this theme would remove to graticules from geom_sf() as well, but it doesn't. Do you think it should?

library(sf) 
library(ggplot2)

nc <- st_read(system.file("gpkg/nc.gpkg", package = "sf")) 

ggplot(nc) + 
  geom_sf(data = nc, aes(fill = AREA)) + 
  theme_void()

# The actual way to remove graticules:
ggplot(nc) + 
  geom_sf(data = nc, aes(fill = AREA)) + 
  coord_sf(datum = NA) + 
  theme_void()

Here's a theme_void map of North Carolina:
North Carolina with graticule

And here's what I expected, with no graticule:
North Carolina no graticule

Ref: #2071

@hadley
Copy link
Member

hadley commented Apr 27, 2018

Duplicate of #2389

@hadley hadley marked this as a duplicate of #2389 Apr 27, 2018
@hadley hadley closed this as completed Apr 27, 2018
@mikmart
Copy link
Contributor

mikmart commented Sep 24, 2018

@hadley this issue still persists after #2389 and the underlying cause seems to be that CoordSf$render_bg() doesn't handle element_blank() as the panel.grid element properly.

@clauswilke
Copy link
Member

I can confirm that this problem still exists in the current github master. I'm reopening the issue.

library(sf) 
#> Linking to GEOS 3.6.1, GDAL 2.1.3, proj.4 4.9.3
library(ggplot2)

nc <- st_read(system.file("gpkg/nc.gpkg", package = "sf"), quiet = TRUE) 

ggplot(nc) + 
  geom_sf(data = nc, aes(fill = AREA)) + 
  theme_void()

Created on 2018-09-24 by the reprex package (v0.2.0).

@clauswilke clauswilke reopened this Sep 24, 2018
@clauswilke clauswilke changed the title Should theme_void remove sf graticules? sf graticules are drawn even if relevant theme elements are set to element_blank() Sep 24, 2018
clauswilke added a commit to wilkelab/ggplot2_archive that referenced this issue Feb 1, 2019
@lock
Copy link

lock bot commented Aug 11, 2019

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/

@lock lock bot locked and limited conversation to collaborators Aug 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants