Learn R Programming

mapsf

Create thematic maps and integrate them into your R workflow.
This package helps you design different cartographic representations such as proportional symbols, choropleths, or typology maps.
It also provides several functions for displaying layout elements that enhance the graphical presentation of maps (e.g., scale bar, north arrow, title, labels).
mapsf maps sf objects on base graphics.

Installation

You can install the released version of mapsf from CRAN with:

install.packages("mapsf")

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

remotes::install_github("riatelab/mapsf", ref = "dev")

Usage

This is a basic example which shows how to create a map with mapsf.

library(mapsf)
# Import the sample dataset
mtq <- mf_get_mtq()
# Plot the base map
mf_map(x = mtq)
# Plot proportional symbols
mf_map(x = mtq, var = "POP", type = "prop", leg_pos = "topright")
# Plot a map layout
mf_layout(
  title = "Population in Martinique",
  credits = "T. Giraud; Sources: INSEE & IGN, 2018"
)

You can find more detailed examples on the “Get Started” section of the package website and you can also download its cheat sheet.

Alternatives

Community Guidelines

One can contribute to the package through pull requests and report issues or ask questions here. See the CONTRIBUTING.md file for detailed instructions on how to contribute.
This project uses conventional commits and semantic versioning.

Copy Link

Version

Install

install.packages('mapsf')

Monthly Downloads

1,965

Version

1.0.0

License

GPL (>= 3)

Maintainer

Timothée Giraud

Last Published

July 1st, 2025

Functions in mapsf (1.0.0)

mf_get_pal

Get color palettes
mf_frame

Plot a frame
mf_get_mtq

Get the 'mtq' dataset
mf_arrow

Plot a north arrow
mapsf

Package description
mf_export

Export a map
mf_choro

Plot a choropleth map
mf_base

Plot an sf object
mf_prop_choro

Plot proportional symbols using choropleth coloration
mf_layout

Plot a map layout
mf_label

Plot labels
mf_legend

Plot a legend
mf_get_ratio

Get map width and height values
mf_png

Export a map in PNG format
mf_get_pencil

Get a pencil layer from polygons
mf_prop

Plot proportional symbols
mf_typo

Plot a typology map
mf_map

Plot a map
mf_worldmap

Plot a point on a world map
mf_raster

Plot a raster
mf_shadow

Plot a shadow
mf_svg

Export a map in SVG format
mf_scale

Plot a scale bar
mf_symb

Plot symbols
mf_symb_choro

Plot symbols using choropleth coloration
mf_inset_on

Plot an inset
mf_init

Initialize a map with a specific extent
mf_theme

Set a theme
mf_title

Plot a title
mf_prop_typo

Plot proportional symbols using typology coloration
mf_distr

Plot a distribution
mf_annotation

Plot an annotation
mf_credits

Plot credits
mf_background

Plot a background image
mf_graticule

Plot graticules
mf_get_borders

Get a border layer from polygons
mf_get_breaks

Get class intervals
mf_grad

Plot graduated symbols
mf_get_links

Get a link layer from a data.frame of links
mf_get_leg_pos

Get the optimal position of a legend