Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

R package for thematic maps

License

NotificationsYou must be signed in to change notification settings

r-tmap/tmap

Repository files navigation

R-CMD-checkCodecov test coverageCRANCRAN checksDownloadsLicenser-universe

tmap is an R package for drawing thematic maps. The API is based onA Layered Grammar ofGraphics andresembles the syntax ofggplot2, a popularR-library for drawing charts.

Installation

Installation oftmap is straightforward:

install.packages("tmap")

In case it fails, please check the dependencies below.

Development version

The development version can be installed from the GitHub repositoryusing one of the following functions:

# install.packages("remotes")remotes::install_github("r-tmap/tmap")# install.packages("pak")pak::pak("r-tmap/tmap")# Or from r-universeinstall.packages("tmap",repos= c("https://r-tmap.r-universe.dev","https://cloud.r-project.org"))

Dependencies

tmap depend on other R packages, which will automatically be installedalong. However, two packagessf ands2 have additional systemrequirements: for Windows users, these are also installed along. ForLinux and MacOS users, these additional libraries may need to beinstalled manually.

Instructions for the libraries GEOS, GDAL and PROJ (required bysf):see the installation instructions ofterra which requires the samelibraries:MacOSandLinux

Instructions for the libraries Abseil and OpenSSL (required bys2):see theinstallationinstructions.

Getting started

Plot a World map of the happy planet index (HPI) per country. The objectWorld is an example spatial data (sf) object that is contained intmap:

tm_shape(World)+    tm_polygons(fill="HPI")

This map can be enhanced in several ways. For instance:

tm_shape(World,crs="+proj=robin")+    tm_polygons(fill="HPI",fill.scale= tm_scale_continuous(values="matplotlib.rd_yl_bu"),fill.legend= tm_legend(title="Happy Planet Index",orientation="landscape",frame=FALSE)                )

Online tmap course

3-6 June, organized jointly byPRStatsandInstats

Additional Resources for Learningtmap

For more in-depth learning on thetmap package, refer to thefollowing resources:

These resources provide a solid foundation for working withtmap inR.


[8]ページ先頭

©2009-2026 Movatter.jp