This is a special version of ggplot2::annotation_raster for use with ggmap.
(It simply removes the requirement for cartesian coordinates.) The only
difference between inset_raster()
and inset_ggmap()
is their arguments.
inset_ggmap()
is simply a wrapper of inset_raster()
with xmin
, ...
,
ymax
arguments equal to the map's bounding box.
Arguments
- raster
raster object to display
- xmin, xmax
x location (in data coordinates) giving horizontal location of raster
- ymin, ymax
y location (in data coordinates) giving vertical location of raster
- interpolate
interpolate the raster? (i.e. antialiasing)
- ggmap
a ggmap object, see
get_map()
Examples
if (FALSE) # save cran check time
bbox <- c(left = -97.1268, bottom = 31.536245, right = -97.099334, top = 31.559652)
terrain_map <- get_stadiamap(bbox, zoom = 14, maptype = "stamen_terrain_background", color = "bw")
#> Error in eval(expr, envir, enclos): object 'bbox' not found
ggmap(terrain_map)
#> Error in eval(expr, envir, enclos): object 'terrain_map' not found
lines_map <- get_stadiamap(bbox, zoom = 14, maptype = "stamen_toner_lines")
#> Error in eval(expr, envir, enclos): object 'bbox' not found
ggmap(lines_map)
#> Error in eval(expr, envir, enclos): object 'lines_map' not found
ggmap(terrain_map) +
inset_ggmap(lines_map)
#> Error in eval(expr, envir, enclos): object 'terrain_map' not found