Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Harper committed Jun 22, 2018
1 parent 0ce1db8 commit 67e0179
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 18 deletions.
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
# History files
.Rhistory
.Rapp.history

# Session Data files
.RData

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
/*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md
.Rproj.user
key
10 changes: 5 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ You can browse [Snazzy Maps](https://snazzymaps.com/) to find a style you like.

The main function to use within the package is `get_snazzymap`. This is a wrapper of the `get_googlemap` function, with the style of the map being set by `mapRef`:

```{r, message = FALSE, echo = TRUE}
```{r exampleMap, message = FALSE, echo = TRUE}
library(ggmapstyles)
basemap <- get_snazzymap("Southampton, UK", mapRef = "https://snazzymaps.com/style/83/muted-blue")
ggmap(basemap)
Expand All @@ -120,21 +120,21 @@ The `mapRef` parameter can accept the Snazzy Map reference in a number of differ

You can also supply additional arguments to the `get_snazzymap` function which are provided to `get_googlemap`. For example, the zoom can be changed as follows:

```{r, message = FALSE, echo = TRUE, cache = TRUE}
```{r themeTwo, message = FALSE, echo = TRUE, cache = TRUE}
basemap <- get_snazzymap("Southampton, UK", mapRef = "98/purple-rain", zoom = 15)
ggmap(basemap)
```

If you would rather use the `style` argument within the `get_googlemap`, you can create a formatted string using the `ggmap_style_sm` function:

```{r, message = FALSE, echo = TRUE}
```{r extractStyleString, message = FALSE, echo = TRUE}
style_string <- ggmap_style_sm("84/pastel-tones")
style_string
```

This string can then easily be reused within any other ggmap function which takes a style argument. This approach is recommended if you want to plot multiple maps with the same basemap:

```{r, echo=TRUE, fig.height=3.3, fig.width=10, message=FALSE, cache = TRUE}
```{r StyleStringMultiple, echo=TRUE, fig.height=3.3, fig.width=10, message=FALSE, cache = TRUE}
plot1 <- ggmap(get_googlemap("Southampton, UK", style = style_string)) + labs(title = "Southampton")
plot2 <- ggmap(get_googlemap("London, UK", style = style_string)) + labs(title = "London")
plot3 <- ggmap(get_googlemap("Bristol, UK", style = style_string)) + labs(title = "Bristol")
Expand All @@ -146,7 +146,7 @@ gridExtra::grid.arrange(plot1, plot2, plot3, ncol = 3)

16 map styles are supplied within the package. These can be accessed by using the `map_styles()` function, and the following styles are available:

```{r}
```{r tableOfStyles}
knitr::kable(ggmapstyles::list_styles())
```

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ basemap <- get_snazzymap("Southampton, UK", mapRef = "https://snazzymaps.com/sty
ggmap(basemap)
```

<img src="man/figures/README-unnamed-chunk-2-1.png" style="display: block; margin: auto;" />
<img src="man/figures/README-exampleMap-1.png" style="display: block; margin: auto;" />

The `mapRef` parameter can accept the Snazzy Map reference in a number of different ways:

Expand All @@ -57,7 +57,7 @@ basemap <- get_snazzymap("Southampton, UK", mapRef = "98/purple-rain", zoom = 15
ggmap(basemap)
```

<img src="man/figures/README-unnamed-chunk-3-1.png" style="display: block; margin: auto;" />
<img src="man/figures/README-themeTwo-1.png" style="display: block; margin: auto;" />

If you would rather use the `style` argument within the `get_googlemap`, you can create a formatted string using the `ggmap_style_sm` function:

Expand All @@ -77,7 +77,7 @@ plot3 <- ggmap(get_googlemap("Bristol, UK", style = style_string)) + labs(title
gridExtra::grid.arrange(plot1, plot2, plot3, ncol = 3)
```

<img src="man/figures/README-unnamed-chunk-5-1.png" style="display: block; margin: auto;" />
<img src="man/figures/README-StyleStringMultiple-1.png" style="display: block; margin: auto;" />

Cached Styles
-------------
Expand Down
1 change: 0 additions & 1 deletion key/.gitignore

This file was deleted.

Binary file added man/figures/README-StyleStringMultiple-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-exampleMap-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-themeTwo-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 67e0179

Please sign in to comment.