knitr::opts_chunk$set(
  collapse = TRUE, comment = "#>", fig.path = "README-",
  message = FALSE, warning = FALSE, error = FALSE, tidy = TRUE)

mapmate

Travis-CI Build Status AppVeyor Build Status Coverage Status Rdoc

mapmate (map animate) is an R package for map animation. It is used to generate and save a sequence of plots to disk as a still image sequence intended for later use in data animation production.

is_md <- knitr::opts_knit$get("rmarkdown.pandoc.to") == "markdown_github-ascii_identifiers"
cat("Here is the complete online [documentation and tutorials with code examples](https://leonawicz.github.io/mapmate/).")

Installation and bug reporting

You can install snapverse from github with:

# install.packages('devtools')
devtools::install_github("leonawicz/mapmate")

Please file a minimal reproducible example of any clear bug at github.

cat(paste0(
  "## Example videos based on mapmate\n\n",
  "### Historical and projected global temperature anomalies\n\n",
  '<p align="center"><iframe src="https://www.youtube.com/embed/xhqEkyJDBho?ecver=2" width="640" height="360" frameborder="0" allowfullscreen></iframe></p>\n\n',
  "### Global UAF/SNAP Shiny Apps web traffic\n\n",
  '<p align="center"><iframe src="https://www.youtube.com/embed/uQYR91qixgo?ecver=2" width="640" height="360" frameborder="0" allowfullscreen></iframe></p>\n\n',
  "### Flat map great circle animation example\n\n",
  '<p align="center"><iframe src="https://www.youtube.com/embed/yoyIUMvIP3Q?ecver=2" width="640" height="360" frameborder="0" allowfullscreen></iframe></p>\n\n'
))

Introduction and basic example

The mapmate package is used for map- and globe-based data animation pre-production. Specifically, mapmate functions are used to generate and save to disk a series of map graphics that make up a still image sequence, which can then be used in video editing and rendering software of the user's choice. This package does not make simple animations directly within R, which can be done with packages like animation. mapmate is more specific to maps, hence the name, and particularly suited to 3D globe plots of the Earth. Functionality and fine-grain user control of inputs and outputs are limited in the current package version.

library(mapmate)
library(dplyr)
data(annualtemps)
annualtemps

library(RColorBrewer)
pal <- rev(brewer.pal(11,"RdYlBu"))

temps <- mutate(annualtemps, frameID = Year - min(Year) + 1)
frame1 <- filter(temps, frameID==1) # subset to first frame
id <- "frameID"

save_map(frame1, z.name="z", id=id, ortho=FALSE, col=pal, type="maptiles", save.plot=FALSE, return.plot=TRUE)
save_map(frame1, z.name="z", id=id, col=pal, type="maptiles", save.plot=FALSE, return.plot=TRUE)

The above is only a very basic initial example of static 2D and 3D maps. See the introduction vignette for more complete and typical usage examples:

This and other vignettes covering more examples, including network maps with great circle arcs and generating video with ffmpeg, can be found at the mapmate website.

Other features and functionality will be added in future package versions.



leonawicz/mapmate documentation built on May 21, 2019, 5:09 a.m.