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

library(ggmap)

# 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")
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
bb

# now your code
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)
plot(gpl)


--
Giorgio Garziano


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to