Skip to content

Commit

Permalink
allow controlling ndiscr in call to sf::st_graticule (#2181)
Browse files Browse the repository at this point in the history
* addresses #2119

* tidy graticule fixes

* ggplot2 side of issue r-spatial/sf#396

* tabs -> spaces

* add ndiscr to docs
  • Loading branch information
edzer authored and hadley committed Jul 3, 2017
1 parent 04a707e commit ac07c62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions R/sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
crs = params$crs,
lat = scale_y$breaks %|W|% NULL,
lon = scale_x$breaks %|W|% NULL,
datum = self$datum
datum = self$datum,
ndiscr = self$ndiscr
)

# remove tick labels not on axes 1 (bottom) and 2 (left)
Expand Down Expand Up @@ -348,15 +349,18 @@ sf_rescale01_x <- function(x, range) {
#' @param crs Use this to select a specific CRS. If not specified, will
#' use the CRS defined in the first layer.
#' @param datum CRS that provides datum to use when generating graticules
#' @param ndiscr number of segments to use for discretizing graticule lines;
#' try increasing this when graticules look unexpected
#' @inheritParams coord_cartesian
#' @export
#' @rdname ggsf
coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE,
crs = NULL, datum = sf::st_crs(4326)) {
crs = NULL, datum = sf::st_crs(4326), ndiscr = 100) {
ggproto(NULL, CoordSf,
limits = list(x = xlim, y = ylim),
datum = datum,
crs = crs,
ndiscr = ndiscr,
expand = expand
)
}
5 changes: 4 additions & 1 deletion man/ggsf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac07c62

Please sign in to comment.