ggmap icon indicating copy to clipboard operation
ggmap copied to clipboard

geom_ggmap

Open hadley opened this issue 9 years ago • 1 comments

Would it be possible to have a geom_ggmap() that made it easier to add a layer to an existing plot?

I think this should just be a simple modification of insert_raster that also gets the attributes from the object. Something like:

geom_ggmap <- function(map) {
  stopifnot(inherits(map, "ggmap"))

  bb <- attr(mi_raster$bb)

  GeomRasterAnn$new(
    geom_params = list(
      raster = raster, 
      xmin = bb[1],
      ymin = bb[2],
      xmax = bb[3],
      ymax = bb[4]
    )
    stat = "identity", 
    position = "identity", 
    data = NULL, 
    inherit.aes = FALSE
  )
}

(note the use of inherit.aes = FALSE - insert_raster should also do that

hadley avatar Jun 17 '15 19:06 hadley

Linked to #160

scottmmjackson avatar Feb 09 '18 23:02 scottmmjackson