I am mystified by this one, and not even sure where to report it. When I create multiple tmap maps in a markdown document, and knit the document, all the titles (from tmap::tm_layout(title="Map xxx") )
end up on the first map.
Reprex here:
---
title: "tmap title problem"
author: "Alan Jackson"
date: "2022-12-13"
output: html_document
---
library(tidyverse)
# Grad state boundaries as convenient polygon set
states <- USAboundaries::us_states(resolution = "low")
knitr::opts_chunk$set(echo = TRUE)
First map
tmap::tmap_mode("view") # set mode to interactive plots
tmap::tm_shape(states) +
tmap::tm_polygons(alpha=0.3, col="geoid")+
tmap::tm_scale_bar()+
tmap::tmap_options(unit = "mi") +
tmap::tm_layout(title="Map One")
second map
tmap::tmap_mode("view") # set mode to interactive plots
tmap::tm_shape(states) +
tmap::tm_polygons(alpha=0.3, col="stusps")+
tmap::tm_scale_bar()+
tmap::tmap_options(unit = "mi") +
tmap::tm_layout(title="Map Two")