-
Notifications
You must be signed in to change notification settings - Fork 285
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
Graticules in geom_sf
#396
Comments
Increasing st_graticule(ndiscr=1000) %>% st_transform("+proj=laea +y_0=0 +lon_0=-77 +lat_0=39 +ellps=WGS84 +no_defs") %>% st_geometry %>% plot but how can we pass this such that it happens inside |
Thanks @edzer, great work as always! |
Other parameters passed to |
There is one set of graticules and they are equivalent to the grid lines in Cartesian coordinations. I think it's pretty clear that the arguments that control them should belong to |
* addresses #2119 * tidy graticule fixes * ggplot2 side of issue r-spatial/sf#396 * tabs -> spaces * add ndiscr to docs
* addresses #2119 * tidy graticule fixes * ggplot2 side of issue r-spatial/sf#396 * tabs -> spaces * add ndiscr to docs * fix #2200 * attempt to fix #2060 All cases were in sf.R a geometry column is address with x$geometry, ggplot2 made the wrong assumption that the geometry column has a fixed name. I replaced this in certain instances, where the data are already pretty transformed and no longer have properties of sf objects, with a fixed position, i.e. x[[1]], which seems to work. * fixes r-spatial/sf#438 * address review comments * fix break on geom_raster, objects without list-column see https://gist.github.com/mdsumner/573ec70014df177baa2d1df7e55e1943 for the case that this PR fixes * tidy up * trying @karawoo's suggestion * adds some sf tests * tidy further
@edzer To continue a discussion on passing the parameters of |
did you try this? ggplot() + ... + scale_y_continuous(breaks = c(40,50,60)) |
Thanks, it works! Much easier than I expected. |
Same thing here! |
There is another small thing with graticules. library(sf)
#> Linking to GEOS 3.5.0, GDAL 2.1.2, proj.4 4.9.2
st_graticule(ndiscr = 1000) %>% st_transform("+proj=laea +x_0=0 +y_0=0 +lon_0=-74 +lat_0=40 +ellps=WGS84 +no_defs") %>% st_geometry %>% plot st_graticule(ndiscr = 1000) %>% st_transform("+proj=laea +x_0=0 +y_0=0 +lon_0=-74 +lat_0=39 +ellps=WGS84 +no_defs") %>% st_geometry %>% plot Created on 2018-01-19 by the reprex |
It goes away if you do e.g. st_graticule(ndiscr = 10000) %>% st_transform("+proj=laea +x_0=0 +y_0=0 +lon_0=-74 +lat_0=40.1 +ellps=WGS84 +no_defs") %>% st_geometry %>% plot that is, change I suspect this is not an issue with sf, but rather with approximating graticules with linestrings for particular projections with regular discretization of angles instead of focusing on where we need many points. It's very unlikely that I will work on solving this in the near future, but if someone would bring up a PR doing this I'd be happy to review. I recall that @hadley pointed me once to a website demonstrating javascript code that did dynamic noding of graticules, but forgot where it was. |
Graticules works well in the first example -
world1
but there are some problems with the second one -world2
:@edzer should I leave it here or post it as the
ggplot2
issue?The text was updated successfully, but these errors were encountered: