-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Errors when plotting sfs (without crs - may be issue) #2199
Comments
And when plotting multiple points: library(sf)
#> Linking to GEOS 3.5.1, GDAL 2.1.3, proj.4 4.9.2, lwgeom 2.3.2 r15302
library(ggplot2)
point_sfc = st_sf(st_sfc(st_point(c(1, 1)), st_point(c(1, 2))))
ggplot() + geom_sf(data = point_sfc) + coord_sf(xlim = c(0.6, 1.6), ylim = c(0.4,
1.4))
#> Error in if (st_is_longlat(crs)) bb = trim_bb(bb, margin): missing value where TRUE/FALSE needed |
And (unexpectedly) MULTIPOINTs: devtools::install_github("tidyverse/ggplot2", ref = "sf")
#> Skipping install of 'ggplot2' from a github remote, the SHA1 (1d6dd5c2) has not changed since last install.
#> Use `force = TRUE` to force installation
library(sf)
#> Linking to GEOS 3.5.1, GDAL 2.1.3, proj.4 4.9.2, lwgeom 2.3.2 r15302
library(ggplot2)
point_sfc = st_sf(st_sfc(st_multipoint(rbind(c(1, 0.6), c(1.4, 1.1)))))
ggplot() + geom_sf(data = point_sfc) + coord_sf(xlim = c(0.6, 1.6), ylim = c(0.4,
1.4))
#> Error in if (st_is_longlat(crs)) bb = trim_bb(bb, margin): missing value where TRUE/FALSE needed |
Demo of how these could look and to show reproducibility with base plot: library(sf)
#> Linking to GEOS 3.5.1, GDAL 2.1.3, proj.4 4.9.2, lwgeom 2.3.2 r15302
x = st_sf(st_sfc(st_point(c(1, 1))))
plot(x) x = st_sf(st_sfc(st_point(c(1, 1)), st_point(c(1, 2))))
plot(x) x = st_sf(st_sfc(st_linestring(rbind(c(0.8, 1), c(0.8, 1.2), c(1, 1.2)))))
plot(x) |
@edzer this error appears to be coming from inside |
edzer
added a commit
to r-spatial/sf
that referenced
this issue
Jul 13, 2017
@Robinlovelace pls check it out |
Works like charm - thanks for the fast fix: devtools::install_github("tidyverse/ggplot2", ref = "sf")
#> Skipping install of 'ggplot2' from a github remote, the SHA1 (1d6dd5c2) has not changed since last install.
#> Use `force = TRUE` to force installation
devtools::install_github("r-spatial/sfr")
#> Skipping install of 'sf' from a github remote, the SHA1 (707704eb) has not changed since last install.
#> Use `force = TRUE` to force installation
library(sf)
#> Linking to GEOS 3.5.1, GDAL 2.1.3, proj.4 4.9.2, lwgeom 2.3.2 r15302
library(ggplot2)
p1 = st_sf(st_sfc(st_point(c(1, 1))))
ggplot() + geom_sf(data = p1) + coord_sf(xlim = c(0.6, 1.6), ylim = c(0.4, 1.4)) p2 = st_sf(st_sfc(st_point(c(1, 1)), st_point(c(1, 2))))
ggplot() + geom_sf(data = p2) + coord_sf(xlim = c(0.6, 1.6), ylim = c(0.4, 1.4)) mp = st_sf(st_sfc(st_multipoint(rbind(c(1, 0.6), c(1.4, 1.1)))))
ggplot() + geom_sf(data = mp) + coord_sf(xlim = c(0.6, 1.6), ylim = c(0.4, 1.4)) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: