-
Notifications
You must be signed in to change notification settings - Fork 2.1k
geom_hline() / geom_vline() don't work with geom_sf() #2820
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
The cause of this problem is that library(ggplot2)
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
#> Reading layer `nc' from data source `/Library/Frameworks/R.framework/Versions/3.5/Resources/library/sf/shape/nc.shp' using driver `ESRI Shapefile'
#> Simple feature collection with 100 features and 14 fields
#> geometry type: MULTIPOLYGON
#> dimension: XY
#> bbox: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
#> epsg (SRID): 4267
#> proj4string: +proj=longlat +datum=NAD27 +no_defs
p <- ggplot(nc) + geom_sf()
b <- ggplot_build(p)
names(b$layout$panel_params[[1]])
#> [1] "x_range" "y_range" "graticule" "crs"
b$layout$coord$range(b$layout$panel_params[[1]])
#> $x
#> NULL
#>
#> $y
#> NULL
p <- ggplot(data.frame(x = 1, y = 1), aes(x, y)) + geom_point()
b <- ggplot_build(p)
names(b$layout$panel_params[[1]])
#> [1] "x.range" "x.labels" "x.major" "x.minor"
#> [5] "x.major_source" "x.minor_source" "x.arrange" "y.range"
#> [9] "y.labels" "y.major" "y.minor" "y.major_source"
#> [13] "y.minor_source" "y.arrange"
b$layout$coord$range(b$layout$panel_params[[1]])
#> $x
#> [1] 0.5 1.5
#>
#> $y
#> [1] 0.5 1.5 Created on 2018-08-10 by the reprex package (v0.2.0). |
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/ |
Reprex below. Primarily reporting this to show the PR I'm about to make didn't mess this up. It's already broken. :-)
Created on 2018-08-10 by the reprex package (v0.2.0).
The text was updated successfully, but these errors were encountered: