Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MilesMcBain/inlegend
Styling for inset ggplot2 map legends
https://github.com/MilesMcBain/inlegend
Last synced: about 2 months ago
JSON representation
Styling for inset ggplot2 map legends
- Host: GitHub
- URL: https://github.com/MilesMcBain/inlegend
- Owner: MilesMcBain
- License: other
- Created: 2020-08-13T05:31:24.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-12T12:41:52.000Z (about 3 years ago)
- Last Synced: 2024-05-21T01:14:13.137Z (4 months ago)
- Language: R
- Size: 6.34 MB
- Stars: 41
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# inlegend
`ggplot2` theming helpers for making static maps with inset legends:
* `inset_legend_dark()`
* `inset_legend_light()`
* `theme_cropped_map()`## Installation
From [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("milesmcbain/inlegend")
```## Example
```{r example, fig.cap = "Bike share capacity, London. Via {spData}", dpi = 200, fig.width = 8}
library(spData)
library(snapbox) ##remotes::install_github("anthonynorth/snapbox")
library(ggplot2)
library(ggspatial)
library(sf)
library(inlegend)
library(stylebox)
ggplot() +
layer_mapbox(
spData::cycle_hire_osm,
stylebox::mapbox_gallery_frank()
) +
layer_spatial(spData::cycle_hire_osm,
aes(colour = capacity),
alpha = 0.75) +
scale_colour_viridis_b() +
inset_legend_light("top-right") +
theme_cropped_map()
```