Lorenzo Isella
unread,Sep 28, 2015, 3:08:17 PM9/28/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to r-h...@r-project.org, ggplot2
Dear All,
Please have a look at the snippet at the end of the email.
Essentially, I am trying to combine google maps with ggplot2.
The idea is to simply plot some points, whose size depend on a scalar,
on a google map.
My question is how I can extend the map in the snippet below in order
to plot the whole world.
Even at the lowest allowed zoom (=2), there are some continents left
out.
I cannot believe there is not a workaround for this while using the
google maps, but so far I have not made any progress at all.
Any suggestion is welcome.
Cheers
Lorenzo
##############################################################
library(ggmap)
map <- get_map(location = 'India', zoom = 2)
n <- 1000
set.seed(1234)
long <- runif(n,-180, 180)
lat <- runif(n,-90, 90)
size <- runif(n, 1,5)
data <- cbind(long, lat, size)
data <- as.data.frame(data)
gpl <- ggmap(map) +
geom_point(data = data,aes(x = long, y = lat),size=data$size, alpha
=1, color="blue",show.legend = F)
ggsave("test-map.pdf", gpl,width=10,height=10)