Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.4%) to scientific vocabulary
Keywords
ggplot2
r
r-package
rspatial
rstats
Last synced: 4 months ago
·
JSON representation
Repository
✏️🟢 Make ggplot2 Map Layers
Basic Info
- Host: GitHub
- Owner: elipousson
- License: other
- Language: R
- Default Branch: main
- Homepage: https://elipousson.github.io/maplayer/
- Size: 21.7 MB
Statistics
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
- Releases: 0
Topics
ggplot2
r
r-package
rspatial
rstats
Created over 3 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Changelog
License
Codemeta
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# maplayer
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://app.codecov.io/gh/elipousson/maplayer?branch=main)
[](https://www.repostatus.org/#active)
[](https://opensource.org/licenses/MIT)
The goal of maplayer is to provide a consistent set of functions for creating map layers using simple feature ([{sf}](https://r-spatial.github.io/sf/)) data, the [{ggplot2}](https://ggplot2.tidyverse.org/) package, and a variety of ggplot2 extension packages.
## Basic functions
The main layers that work with both a data and location sf object are:
- `layer_location_data()`
- `layer_location()`
- `layer_location_context()`
There are several layers that can work with a single sf object as the input data:
- `layer_markers()`
- `layer_numbers()`
- `layer_frame()`
- `layer_scaled()`
- `layer_mask()`
- `layer_neatline()`
Finally, there are layers that require additional packages (listed in Suggests):
- `layer_labelled()` optionally uses [{ggrepel}](https://ggrepel.slowkow.com/) or [{geomtextpath}](https://allancameron.github.io/geomtextpath/)
- `layer_mapbox()` uses [{mapboxapi}](https://walker-data.com/mapboxapi/) (requires an API key)
- `layer_marked()` uses [{ggforce}](https://ggforce.data-imaginist.com/)
- `layer_icon()` uses [{ggsvg}](https://coolbutuseless.github.io/package/ggsvg/)
- `layer_inset()` uses [{patchwork}](https://patchwork.data-imaginist.com/) or optionally [{figpatch}](https://bradyajohnston.github.io/figpatch/) (for `stamp_inset_img()`)
The package also allows the optional use of packages designed for transforming spatial data or modifying ggplot2 maps. These include:
- [{smoothr}](https://strimas.com/smoothr/) (required to use the smooth_params argument)
- [{ggfx}](https://ggfx.data-imaginist.com/) (required to use the shadow_params argument)
Many of the functions in {maplayer} were originally developed for the [{overedge}](chttps://elipousson.github.io/overedge/) package or before that for the [{mapbaltimore}](https://elipousson.github.io/mapbaltimore/) package. The {overedge} package has been split up into three smaller packages including {maplayer}, [{getdata}](https://elipousson.github.io/getdata/), and [{sfext}](https://elipousson.github.io/sfext/).
## Installation
You can install the development version of maplayer like so:
``` r
pak::pkg_install("elipousson/maplayer")
```
## Example
```{r setup}
library(maplayer)
library(ggplot2)
library(sf)
```
### Add icons to a map
`layer_icon()` wraps `ggsvg::geom_point_svg()` to provide an convenient way to make icon maps.
You can create maps using a single named icon that matches one of the icons in `map_icons`.
```{r}
nc <- read_sf(system.file("shape/nc.shp", package = "sf"))
nc <- st_transform(nc, 3857)
theme_set(theme_void())
nc_map <-
ggplot() +
geom_sf(data = nc)
nc_map +
layer_icon(data = nc, icon = "point-start", size = 8)
```
### Add a neatline to a map
`layer_neatline()` hides major grid lines and axis label by default. The function is useful to draw a neatline around a map at a set aspect ratio.
```{r}
nc_map +
layer_neatline(
data = nc,
asp = "6:4",
color = "gray60", linewidth = 2, linetype = "dashed"
)
```
`layer_neatline()` can also be used to focus on a specific area of a map with the option to apply a buffer as a distance or ratio of the diagonal distance for the input data. The `label_axes` and `hide_grid` parameters will not override a set ggplot theme.
```{r}
nc_map +
layer_neatline(
data = nc[1, ],
diag_ratio = 0.5,
asp = 1,
color = "black",
label_axes = "--EN",
hide_grid = FALSE,
expand = FALSE
)
```
### Add labels or numbers to a map
```{r}
nc_map +
layer_labelled(
data = nc[c(10, 20, 30, 40), ],
geom = "sf_label",
mapping = aes(label = NAME)
)
```
```{r}
nc_map +
layer_numbers(
data = nc[c(10, 20, 30, 40), ],
aes(fill = NAME),
num_style = "Alph",
size = 3.5
) +
guides(fill = "none")
```
### Create a frame around a feature
```{r}
circle_nc <-
ggplot(data = nc) +
# layer_frame requires a data arg if neatline = TRUE
layer_frame(data = nc, style = "circle") +
# layer_location_data can inherit data
layer_location_data()
circle_nc
```
### Create an inset map
```{r}
nc_context <-
layer_frame(
data = nc,
linetype = "twodash",
neatline = FALSE,
basemap = TRUE
) +
layer_location_context(
location = nc[25, ],
context = nc,
context_params = list(fill = "white", color = "gray80", alpha = 1),
neatline = FALSE
)
nc_context +
layer_neatline(
data = nc[25, ],
dist = 15,
unit = "mi",
asp = 1
) +
layer_inset(
inset = nc_context,
scale = 1.5
)
```
Owner
- Name: Eli Pousson
- Login: elipousson
- Kind: user
- Location: Baltimore, MD
- Company: Baltimore City Department of Planning
- Website: https://elipousson.github.io/
- Twitter: elipousson
- Repositories: 95
- Profile: https://github.com/elipousson
I love old buildings and bicycles. Planner with the Baltimore City Department of Planning. Former preservationist @baltimoreheritage
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"identifier": "maplayer",
"description": "Make map-making with ggplot2 and sf more convenient with layers that subset by location.",
"name": "maplayer: Make Map Layers With ggplot2",
"relatedLink": "https://elipousson.github.io/maplayer/",
"codeRepository": "https://github.com/elipousson/maplayer",
"issueTracker": "https://github.com/elipousson/maplayer/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.1.0.9003",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.3.0 (2023-04-21)",
"author": [
{
"@type": "Person",
"givenName": "Eli",
"familyName": "Pousson",
"email": "eli.pousson@gmail.com",
"@id": "https://orcid.org/0000-0001-8280-1706"
}
],
"copyrightHolder": [
{
"@type": "Person",
"givenName": "Eli",
"familyName": "Pousson",
"email": "eli.pousson@gmail.com",
"@id": "https://orcid.org/0000-0001-8280-1706"
}
],
"maintainer": [
{
"@type": "Person",
"givenName": "Eli",
"familyName": "Pousson",
"email": "eli.pousson@gmail.com",
"@id": "https://orcid.org/0000-0001-8280-1706"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "covr",
"name": "covr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=covr"
},
{
"@type": "SoftwareApplication",
"identifier": "figpatch",
"name": "figpatch",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=figpatch"
},
{
"@type": "SoftwareApplication",
"identifier": "filenamr",
"name": "filenamr",
"version": ">= 0.1.0.9002",
"sameAs": "https://github.com/elipousson/filenamr"
},
{
"@type": "SoftwareApplication",
"identifier": "geomtextpath",
"name": "geomtextpath",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=geomtextpath"
},
{
"@type": "SoftwareApplication",
"identifier": "ggarchery",
"name": "ggarchery",
"version": ">= 0.4.1",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://github.com/mdhall272/ggarchery"
},
{
"@type": "SoftwareApplication",
"identifier": "ggforce",
"name": "ggforce",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggforce"
},
{
"@type": "SoftwareApplication",
"identifier": "ggfx",
"name": "ggfx",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggfx"
},
{
"@type": "SoftwareApplication",
"identifier": "ggpath",
"name": "ggpath",
"version": ">= 0.0.0.9000",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggpath"
},
{
"@type": "SoftwareApplication",
"identifier": "ggpattern",
"name": "ggpattern",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggpattern"
},
{
"@type": "SoftwareApplication",
"identifier": "ggrepel",
"name": "ggrepel",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggrepel"
},
{
"@type": "SoftwareApplication",
"identifier": "ggsvg",
"name": "ggsvg",
"version": ">= 0.1.11",
"sameAs": "https://github.com/coolbutuseless/ggsvg"
},
{
"@type": "SoftwareApplication",
"identifier": "ggtext",
"name": "ggtext",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggtext"
},
{
"@type": "SoftwareApplication",
"identifier": "gridExtra",
"name": "gridExtra",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=gridExtra"
},
{
"@type": "SoftwareApplication",
"identifier": "lwgeom",
"name": "lwgeom",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=lwgeom"
},
{
"@type": "SoftwareApplication",
"identifier": "magick",
"name": "magick",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=magick"
},
{
"@type": "SoftwareApplication",
"identifier": "mapboxapi",
"name": "mapboxapi",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=mapboxapi"
},
{
"@type": "SoftwareApplication",
"identifier": "paletteer",
"name": "paletteer",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=paletteer"
},
{
"@type": "SoftwareApplication",
"identifier": "patchwork",
"name": "patchwork",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=patchwork"
},
{
"@type": "SoftwareApplication",
"identifier": "qpdf",
"name": "qpdf",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=qpdf"
},
{
"@type": "SoftwareApplication",
"identifier": "roxygen2",
"name": "roxygen2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=roxygen2"
},
{
"@type": "SoftwareApplication",
"identifier": "rsvg",
"name": "rsvg",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rsvg"
},
{
"@type": "SoftwareApplication",
"identifier": "smoothr",
"name": "smoothr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=smoothr"
},
{
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"version": ">= 3.0.0",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=testthat"
},
{
"@type": "SoftwareApplication",
"identifier": "tibble",
"name": "tibble",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tibble"
},
{
"@type": "SoftwareApplication",
"identifier": "vdiffr",
"name": "vdiffr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=vdiffr"
}
],
"softwareRequirements": {
"1": {
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 2.10"
},
"2": {
"@type": "SoftwareApplication",
"identifier": "cli",
"name": "cli",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=cli"
},
"3": {
"@type": "SoftwareApplication",
"identifier": "cliExtras",
"name": "cliExtras",
"version": ">= 0.1.0",
"sameAs": "https://github.com/elipousson/cliExtras"
},
"4": {
"@type": "SoftwareApplication",
"identifier": "dplyr",
"name": "dplyr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=dplyr"
},
"5": {
"@type": "SoftwareApplication",
"identifier": "getdata",
"name": "getdata",
"version": ">= 0.1.0",
"sameAs": "https://github.com/elipousson/getdata"
},
"6": {
"@type": "SoftwareApplication",
"identifier": "ggplot2",
"name": "ggplot2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggplot2"
},
"7": {
"@type": "SoftwareApplication",
"identifier": "glue",
"name": "glue",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=glue"
},
"8": {
"@type": "SoftwareApplication",
"identifier": "lifecycle",
"name": "lifecycle",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=lifecycle"
},
"9": {
"@type": "SoftwareApplication",
"identifier": "papersize",
"name": "papersize",
"version": ">= 0.1.0.9001",
"sameAs": "https://github.com/elipousson/papersize"
},
"10": {
"@type": "SoftwareApplication",
"identifier": "rlang",
"name": "rlang",
"version": ">= 1.1.0",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rlang"
},
"11": {
"@type": "SoftwareApplication",
"identifier": "scales",
"name": "scales",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=scales"
},
"12": {
"@type": "SoftwareApplication",
"identifier": "sf",
"name": "sf",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=sf"
},
"13": {
"@type": "SoftwareApplication",
"identifier": "sfext",
"name": "sfext",
"version": ">= 0.1.0",
"sameAs": "https://github.com/elipousson/sfext"
},
"14": {
"@type": "SoftwareApplication",
"identifier": "vctrs",
"name": "vctrs",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=vctrs"
},
"SystemRequirements": null
},
"fileSize": "802.785KB",
"releaseNotes": "https://github.com/elipousson/maplayer/blob/master/NEWS.md",
"readme": "https://github.com/elipousson/maplayer/blob/main/README.md",
"contIntegration": "https://app.codecov.io/gh/elipousson/maplayer?branch=main",
"developmentStatus": [
"https://lifecycle.r-lib.org/articles/stages.html#experimental",
"https://www.repostatus.org/#active"
],
"keywords": [
"ggplot2",
"r-package",
"rspatial",
"rstats",
"r"
]
}
GitHub Events
Total
Last Year
Committers
Last synced: almost 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Eli Pousson | e****n@g****m | 249 |
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Dependencies
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION
cran
- R >= 2.10 depends
- cli * imports
- cliExtras >= 0.1.0 imports
- dplyr * imports
- filenamr >= 0.1.0 imports
- getdata >= 0.1.0 imports
- ggplot2 * imports
- glue * imports
- papersize >= 0.1.0 imports
- purrr * imports
- rlang * imports
- scales * imports
- sf * imports
- sfext >= 0.1.0 imports
- stringr * imports
- covr * suggests
- figpatch * suggests
- geomtextpath * suggests
- ggforce * suggests
- ggfx * suggests
- ggpath >= 0.0.0.9000 suggests
- ggpattern * suggests
- ggrepel * suggests
- ggsvg >= 0.1.11 suggests
- gridExtra * suggests
- magick * suggests
- mapboxapi * suggests
- paletteer * suggests
- patchwork * suggests
- qpdf * suggests
- rsvg * suggests
- smoothr * suggests
- testthat >= 3.0.0 suggests
- tibble * suggests
- vdiffr * suggests