Skip to content

r ggplotly implementation of ggmap #649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AmyMikhail opened this issue Jul 20, 2016 · 1 comment
Closed

r ggplotly implementation of ggmap #649

AmyMikhail opened this issue Jul 20, 2016 · 1 comment

Comments

@AmyMikhail
Copy link

I map coordinates using ggmap to put a google map in the background and plot basic points on top of it. It would be nice to be able to identify the points on the map with a label of my choosing, using ggplotly. However, it appears this is not yet implemented.

I have R 3.3.0 and am using ggmap_2.6.1 and plotly plotly_3.4.13 in RStudio 0.99.489.

Running the following on coordinates and descriptive variables from the data.table called linelist:
`# Create a boundary box to zoom manually
bbox <- ggmap::make_bbox(lon, lat, linelist, f = 0.85)

Get a map centred on the boundary box

map_loc <- get_map(location = bbox, source = 'google', maptype = "roadmap", crop = FALSE, color = "bw")

Plot the map in the background

map <- ggmap(map_loc, extent = 'device', maprange = FALSE)

Add the points for each postcode, here I've used case definition and given them different colours

map <- map + geom_point(data = linelist, aes(x = lon, y = lat, fill = casedef), colour = "black", pch = 21, size = 3) +
scale_fill_manual(values = c("blue", "red")) +
labs(fill = "SNP address") +
scale_size(guide = "none")
map2 <- ggplotly()`

Gives this message:
Warning message: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) : geom_GeomRasterAnn() has yet to be implemented in plotly. If you'd like to see this geom implemented, Please open an issue with your example code at https://github.com/ropensci/plotly/issues

When I look at map2 I can see the points and there is a label if I hover over them, but they are joined by lines and there is no map in the background.

It would be great if this feature could be added.

@cpsievert
Copy link
Collaborator

Duplicate of #348

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants