[R] Creating World Map with Points

Giorgio Garziano giorgio.garziano at ericsson.com
Tue Sep 29 15:22:09 CEST 2015

I had to update low/up longitude and latitude attributes of the zoom=1 map
with those of zoom=2 map.


# the zoom=2 map works with ggmap(), however it does not show Americas and all Pacific Ocean

map <- get_map(location = 'India', zoom=2)
bb <- attr(map, "bb")

# the zoom=1 shows all entire world

map <- get_map(location = 'India', zoom=1)
attr(map, "bb")

# changing latitude and longitude upper and lower bounds
attr(map, "bb") <- bb

# now your code
n <- 1000
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)

Giorgio Garziano

	[[alternative HTML version deleted]]

More information about the R-help mailing list