maplegend

Create legends for maps and other graphics.

https://github.com/riatelab/maplegend

Science Score: 52.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
    Organization riatelab has institutional domain (riate.cnrs.fr)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Keywords

legend maps rstats
Last synced: 6 months ago · JSON representation ·

Repository

Create legends for maps and other graphics.

Basic Info
  • Host: GitHub
  • Owner: riatelab
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 686 KB
Statistics
  • Stars: 14
  • Watchers: 4
  • Forks: 0
  • Open Issues: 3
  • Releases: 2
Topics
legend maps rstats
Created about 3 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog Citation Codemeta

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

# maplegend


[![R-CMD-check](https://github.com/riatelab/maplegend/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/riatelab/maplegend/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/riatelab/maplegend/branch/main/graph/badge.svg)](https://app.codecov.io/gh/riatelab/maplegend?branch=main)
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)


Create legends for maps and other graphics. Thematic maps need to be accompanied by legible legends to be fully comprehensible. This package offers a wide range of legends useful for cartography, some of which may also be useful for other types of graphics. 

## Installation

You can install the released version of `maplegend` from
CRAN with:

``` r
install.packages("maplegend")
```

Alternatively, you can install the development version of `maplegend` from
GitHub (**dev** branch) with:

``` r
remotes::install_github("riatelab/maplegend", ref = "dev")
```


## Example

The main function is `leg()`. Its `type` argument defines the legend type. 
```{r example, fig.width=9, fig.height=4.5, fig.show="hold"}
library(maplegend)
opar <- par(mar = c(1, 1, 1, 1), mfrow = c(1, 2))
plot.new()
plot.window(xlim = c(0, 1), ylim = c(0, 1), asp = 1)
leg(type = "prop", val = c(10, 50, 100), pos = "topleft")
leg(type = "choro", val = c(10, 20, 30, 40, 50), pos = "bottomleft")
leg(type = "typo", val = c("A", "B", "C"), pos = "top")
leg(type = "symb", val = c("A", "B", "C"), pos = "topright")
leg(type = "prop_line", val = c(5, 50, 100), pos = "bottom", lwd = 20)
leg(type = "grad_line", val = c(1, 4, 10, 15), pos = "bottomright", lwd = c(1, 5, 10))
box()
plot.new()
plot.window(xlim = c(0, 100), ylim = c(-50, 50), asp = 1)
leg(type = "prop", val = c(10, 50, 100), pos = "topleft", horiz = TRUE)
leg(type = "choro", val = c(10, 20, 30, 40, 50), pos = "left", horiz = TRUE)
leg(type = "cont", val = c(10, 20, 30, 40, 50), pos = "bottomleft", horiz = TRUE)
leg(type = "cont", val = c(10, 20, 30, 40, 50), pos = c(75, 0), horiz = FALSE)
leg(type = "symb", val = c("Points", "Lines", "Polygons"), pos = "topright", 
    pch = list(21, "৲", 22), cex = c(2,2,2), border = c("black", "black"), 
    pal = c("red", "blue", "grey90"))
box()
```


It is possible to create composed legends with `leg_comp()` and `leg_draw()`.


```{r example2, fig.width=4.5, fig.height=4.5, fig.show="hold"}
opar <- par(mar = c(1, 1, 1, 1))
plot.new()
plot.window(xlim = c(0, 1), ylim = c(0, 1), asp = 1)
leg_comp(type = "prop", val = c(10, 50, 100)) |>
  leg_comp(type = "typo", val = c("A", "B", "C")) |>
  leg_draw(pos = "top", bg = "lightblue", fg = "darkblue", frame_border = NA)
box()
par(opar)
```


## Background

This package is mainly intended for the construction of legends in the [`mapsf`](https://riatelab.github.io/mapsf/) package. 
However, it can also be used independently of `mapsf` with `base` plots or even with [`igraph` plots](https://gist.github.com/rCarto/da5a4b0cd982a8c85cb847506fd2f415).


## Community Guidelines

One can contribute to the package through [pull
requests](https://github.com/riatelab/maplegend/pulls) and report issues or
ask questions [here](https://github.com/riatelab/maplegend/issues).  
This project uses [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0-beta.3/) and
[semantic versioning](https://semver.org/).

Owner

  • Name: riatelab
  • Login: riatelab
  • Kind: organization
  • Location: Paris

Spatial analysis and mapping software packages created by the Center for Spatial Analysis and Geovisualization - RIATE

Citation (CITATION.cff)

# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------
 
cff-version: 1.2.0
message: 'To cite package "maplegend" in publications use:'
type: software
license: GPL-3.0-only
title: 'maplegend: Legends for Maps'
version: 0.3.0
doi: 10.32614/CRAN.package.maplegend
abstract: Create legends for maps and other graphics. Thematic maps need to be accompanied
  by legible legends to be fully comprehensible. This package offers a wide range
  of legends useful for cartography, some of which may also be useful for other types
  of graphics.
authors:
- family-names: Giraud
  given-names: Timothée
  email: timothee.giraud@cnrs.fr
  orcid: https://orcid.org/0000-0002-1932-3323
repository: https://CRAN.R-project.org/package=maplegend
repository-code: https://github.com/riatelab/maplegend/issues/
url: https://github.com/riatelab/maplegend/
contact:
- family-names: Giraud
  given-names: Timothée
  email: timothee.giraud@cnrs.fr
  orcid: https://orcid.org/0000-0002-1932-3323
references:
- type: software
  title: 'R: A Language and Environment for Statistical Computing'
  notes: Depends
  url: https://www.R-project.org/
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
  version: '>= 4.1.0'
- type: software
  title: graphics
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
- type: software
  title: grDevices
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  institution:
    name: R Foundation for Statistical Computing
    address: Vienna, Austria
  year: '2025'
- type: software
  title: tinytest
  abstract: 'tinytest: Lightweight and Feature Complete Unit Testing Framework'
  notes: Suggests
  url: https://github.com/markvanderloo/tinytest
  repository: https://CRAN.R-project.org/package=tinytest
  authors:
  - family-names: Loo
    given-names: Mark
    name-particle: van der
    email: mark.vanderloo@gmail.com
    orcid: https://orcid.org/0000-0002-9807-4686
  year: '2025'
  doi: 10.32614/CRAN.package.tinytest
- type: software
  title: covr
  abstract: 'covr: Test Coverage for Packages'
  notes: Suggests
  url: https://covr.r-lib.org
  repository: https://CRAN.R-project.org/package=covr
  authors:
  - family-names: Hester
    given-names: Jim
    email: james.f.hester@gmail.com
  year: '2025'
  doi: 10.32614/CRAN.package.covr

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "maplegend",
  "description": "Create legends for maps and other graphics. Thematic maps need to be accompanied by legible legends to be fully comprehensible. This package offers a wide range of legends useful for cartography, some of which may also be useful for other types of graphics. ",
  "name": "maplegend: Legends for Maps",
  "codeRepository": "https://github.com/riatelab/maplegend/",
  "issueTracker": "https://github.com/riatelab/maplegend/issues/",
  "license": "https://spdx.org/licenses/GPL-3.0",
  "version": "0.3.0",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.5.0 (2025-04-11)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Timothe",
      "familyName": "Giraud",
      "email": "timothee.giraud@cnrs.fr",
      "@id": "https://orcid.org/0000-0002-1932-3323"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Timothe",
      "familyName": "Giraud",
      "email": "timothee.giraud@cnrs.fr",
      "@id": "https://orcid.org/0000-0002-1932-3323"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "tinytest",
      "name": "tinytest",
      "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=tinytest"
    },
    {
      "@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"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 4.1.0"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "graphics",
      "name": "graphics"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "grDevices",
      "name": "grDevices"
    },
    "SystemRequirements": null
  },
  "fileSize": "141.653KB"
}

GitHub Events

Total
  • Release event: 2
  • Watch event: 2
  • Push event: 4
  • Create event: 2
Last Year
  • Release event: 2
  • Watch event: 2
  • Push event: 4
  • Create event: 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 4
  • Total pull requests: 0
  • Average time to close issues: 6 months
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: 17 days
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rCarto (3)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 1,629 last-month
  • Total dependent packages: 2
  • Total dependent repositories: 1
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: maplegend

Legends for Maps

  • Versions: 3
  • Dependent Packages: 2
  • Dependent Repositories: 1
  • Downloads: 1,629 Last month
Rankings
Stargazers count: 15.8%
Downloads: 17.0%
Dependent packages count: 18.1%
Average: 20.5%
Dependent repos count: 23.9%
Forks count: 27.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 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 v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 3.6.0 depends
  • grDevices * imports
  • graphics * imports
  • covr * suggests
  • tinytest * suggests