From 01837529f3b58e4d5659cd96e9a286ae8eb6cf00 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Sat, 1 Apr 2017 21:18:07 -0300 Subject: [PATCH] fix osm inheritance error, trim examples to help with check time --- R/geom-osm.R | 3 ++- R/geom-spatial.R | 9 --------- R/geom-spraster.R | 6 ++++-- man/geom_osm.Rd | 2 +- man/geom_spatial.Raster.Rd | 3 ++- man/geom_spatial.Rd | 9 --------- man/stat_rgba.Rd | 3 ++- 7 files changed, 11 insertions(+), 24 deletions(-) diff --git a/R/geom-osm.R b/R/geom-osm.R index 34dda34..62eb10f 100644 --- a/R/geom-osm.R +++ b/R/geom-osm.R @@ -38,7 +38,7 @@ #' library(prettymapr) #' # use as a backdrop for geographical data #' cities <- geocode(c("Halifax, NS", "Moncton, NB", "Montreal QC")) -#' ggplot(cities, aes(lon, lat)) + geom_osm() + +#' ggplot(cities, aes(lon, lat, shape = query)) + geom_osm() + #' geom_point() + coord_map() #' #' # use ggosm() shorthand @@ -76,6 +76,7 @@ geom_osm <- function(x = NULL, zoomin=0, zoom=NULL, type=NULL, forcedownload=FAL # return GeomTileSource layer layer(data = data, mapping = ggplot2::aes_string("x", "y"), position = "identity", geom = GeomTileSource, stat = "identity", + show.legend = FALSE, inherit.aes = FALSE, params = list(na.rm = TRUE, zoomin = zoomin, zoom = zoom, type = type, forcedownload = forcedownload, cachedir = cachedir, progress = progress, quiet = quiet)) diff --git a/R/geom-spatial.R b/R/geom-spatial.R index 623c472..b2492f9 100644 --- a/R/geom-spatial.R +++ b/R/geom-spatial.R @@ -38,23 +38,14 @@ #' } #' #' # plot a number of spatial objects -#' data(longlake_marshdf, longlake_roadsdf, longlake_waterdf, longlake_depthdf, -#' longlake_streamsdf, longlake_buildingsdf) #' ggplot() + #' geom_spatial(longlake_waterdf, fill="lightblue") + #' geom_spatial(longlake_marshdf, fill="grey", alpha=0.5) + #' geom_spatial(longlake_streamsdf, col="lightblue") + #' geom_spatial(longlake_roadsdf, col="black") + #' geom_spatial(longlake_buildingsdf, pch=1, col="brown", size=0.25) + -#' geom_spatial(longlake_depthdf, aes(col=DEPTH.M)) + -#' facet_wrap(~NOTES)+ #' coord_map() #' -#' -#' library(maptools) -#' data(wrld_simpl) -#' ggplot() + geom_spatial(wrld_simpl) -#' geom_spatial <- function(data, ...) UseMethod("geom_spatial") diff --git a/R/geom-spraster.R b/R/geom-spraster.R index 6b9d8f7..93015cc 100644 --- a/R/geom-spraster.R +++ b/R/geom-spraster.R @@ -195,9 +195,10 @@ geom_spraster_rgb <- function(raster, interpolate = FALSE, na.value = NA) { #' @examples #' # standard ggplot syntax #' ggplot() + geom_spatial(longlake_osm, aes(fill = band1)) + coord_fixed() -#' +#' \donttest{ #' # or use ggraster() #' ggraster(longlake_osm, aes(fill = band1)) +#' } #' geom_spatial.Raster <- function(data, mapping = NULL, show.legend = TRUE, inherit.aes=FALSE, position = "identity", crsfrom = crsfrom, crsto = crsto, @@ -269,10 +270,11 @@ ggraster <- function(data, mapping = NULL, ...) { #' limits_red = NULL, limits_green = NULL, limits_blue = NULL, #' limits_alpha = NULL, interpolate = TRUE) + #' coord_fixed() -#' +#' \donttest{ #' # using ggraster() with stat = 'rgba' #' ggraster(longlake_osm, aes(red = band1, green = band2, blue = band3, alpha = 1), #' stat = "rgba") +#' } #' stat_rgba <- function(mapping = NULL, data = NULL, ..., limits_red = NA, limits_green = NA, limits_blue = NA, limits_alpha = NA) { diff --git a/man/geom_osm.Rd b/man/geom_osm.Rd index 1c4bcf0..f9923bc 100644 --- a/man/geom_osm.Rd +++ b/man/geom_osm.Rd @@ -59,7 +59,7 @@ coord_map()}. library(prettymapr) # use as a backdrop for geographical data cities <- geocode(c("Halifax, NS", "Moncton, NB", "Montreal QC")) -ggplot(cities, aes(lon, lat)) + geom_osm() + +ggplot(cities, aes(lon, lat, shape = query)) + geom_osm() + geom_point() + coord_map() # use ggosm() shorthand diff --git a/man/geom_spatial.Raster.Rd b/man/geom_spatial.Raster.Rd index 87b0344..9c358e0 100644 --- a/man/geom_spatial.Raster.Rd +++ b/man/geom_spatial.Raster.Rd @@ -48,9 +48,10 @@ to \code{coord_fixed()}. \examples{ # standard ggplot syntax ggplot() + geom_spatial(longlake_osm, aes(fill = band1)) + coord_fixed() - +\donttest{ # or use ggraster() ggraster(longlake_osm, aes(fill = band1)) +} } diff --git a/man/geom_spatial.Rd b/man/geom_spatial.Rd index 4eacedf..f79bc0c 100644 --- a/man/geom_spatial.Rd +++ b/man/geom_spatial.Rd @@ -91,22 +91,13 @@ ggplot(cities, aes(x=lon, y=lat)) + geom_spatial() + coord_map() } # plot a number of spatial objects -data(longlake_marshdf, longlake_roadsdf, longlake_waterdf, longlake_depthdf, - longlake_streamsdf, longlake_buildingsdf) ggplot() + geom_spatial(longlake_waterdf, fill="lightblue") + geom_spatial(longlake_marshdf, fill="grey", alpha=0.5) + geom_spatial(longlake_streamsdf, col="lightblue") + geom_spatial(longlake_roadsdf, col="black") + geom_spatial(longlake_buildingsdf, pch=1, col="brown", size=0.25) + - geom_spatial(longlake_depthdf, aes(col=DEPTH.M)) + - facet_wrap(~NOTES)+ coord_map() - -library(maptools) -data(wrld_simpl) -ggplot() + geom_spatial(wrld_simpl) - } diff --git a/man/stat_rgba.Rd b/man/stat_rgba.Rd index 681cfd8..da0678e 100644 --- a/man/stat_rgba.Rd +++ b/man/stat_rgba.Rd @@ -38,10 +38,11 @@ ggplot(longlake_osm, aes(x, y)) + limits_red = NULL, limits_green = NULL, limits_blue = NULL, limits_alpha = NULL, interpolate = TRUE) + coord_fixed() - +\donttest{ # using ggraster() with stat = 'rgba' ggraster(longlake_osm, aes(red = band1, green = band2, blue = band3, alpha = 1), stat = "rgba") +} }