diff --git a/README-maptypes-1.png b/README-maptypes-1.png index 6cffea9..2dbe664 100644 Binary files a/README-maptypes-1.png and b/README-maptypes-1.png differ diff --git a/README-maptypes-2.png b/README-maptypes-2.png index 78ec303..6ba13fd 100644 Binary files a/README-maptypes-2.png and b/README-maptypes-2.png differ diff --git a/README-maptypes-3.png b/README-maptypes-3.png index ad7bf2b..44876da 100644 Binary files a/README-maptypes-3.png and b/README-maptypes-3.png differ diff --git a/README-qmplot-1.png b/README-qmplot-1.png index c614bb4..ed63f58 100644 Binary files a/README-qmplot-1.png and b/README-qmplot-1.png differ diff --git a/README-qmplot-2.png b/README-qmplot-2.png index 3664b06..6779c24 100644 Binary files a/README-qmplot-2.png and b/README-qmplot-2.png differ diff --git a/README.Rmd b/README.Rmd index 7289476..2a16096 100644 --- a/README.Rmd +++ b/README.Rmd @@ -22,9 +22,12 @@ ggmap makes it easy to retrieve raster map tiles from popular online mapping ser ```{r maptypes, message = FALSE} library(ggmap) -ggmap(get_googlemap()) -ggmap(get_stamenmap()) -ggmap(get_stamenmap(maptype = "toner-background")) +(map <- get_map("pat neff hall", zoom = 15)) +ggmap(map) + +(extent <- bb2bbox(attr(map, "bb"))) +ggmap(get_stamenmap(extent, zoom = 15)) +ggmap(get_stamenmap(extent, zoom = 15, maptype = "toner-background")) ``` Use `qmplot()` in the same way you'd use `qplot()`, but with a map automatically added in the background: diff --git a/README.md b/README.md index af1b40d..4c22f18 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,38 @@ - - - ggmap ===== ggmap makes it easy to retrieve raster map tiles from popular online mapping services like google maps, open street maps, cloudmade and stamen: -``` {.r} +``` r library(ggmap) -ggmap(get_googlemap()) +(map <- get_map("pat neff hall", zoom = 15)) +#> 1280x1280 terrain map image from Google Maps. see ?ggmap to plot it. +ggmap(map) ``` ![](README-maptypes-1.png) -``` {.r} -ggmap(get_stamenmap()) +``` r + +(extent <- bb2bbox(attr(map, "bb"))) +#> left bottom right top +#> -97.13503 31.53403 -97.10756 31.55743 +ggmap(get_stamenmap(extent, zoom = 15)) ``` ![](README-maptypes-2.png) -``` {.r} -ggmap(get_stamenmap(maptype = "toner-background")) +``` r +ggmap(get_stamenmap(extent, zoom = 15, maptype = "toner-background")) ``` ![](README-maptypes-3.png) Use `qmplot()` in the same way you'd use `qplot()`, but with a map automatically added in the background: -``` {.r} +``` r downtown <- subset(crime, -95.39681 <= lon & lon <= -95.34188 & 29.73631 <= lat & lat <= 29.78400 @@ -40,7 +43,7 @@ qmplot(lon, lat, data = downtown, maptype = "toner-background", color = I("red") ![](README-qmplot-1.png) -``` {.r} +``` r qmplot(lon, lat, data = downtown, maptype = "toner-lite", geom = "density2d", color = I("red")) ```