dkahle / dkahle/ggmap

geom_ggmap

Open
#58 1 comment 5 reactions 0 assignees View on GitHub
feature request
Dominant language
R
Stars
778
Forks
234
PR merge metrics
No merged PRs in 30d

Description

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:

``` R
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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing insert_raster implementation and the proposed geom_ggmap interface in this issue, then inspect how ggmap objects store their raster and bounding-box attributes. Done means a ggmap object can be added as a layer to an existing plot, with aesthetics not inherited as requested, and the existing raster behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.