library(MazamaSpatialPlots)
stateMap(
data = example_US_stateObesity,
parameter = "obesityRate",
stateBorderColor = "white",
title = "2018 Obesity by State"
)
# Example of customization using tm_layout and breaks parameter
stateMap(
data = example_US_stateObesity,
parameter = "obesityRate",
breaks = seq(20,38,3),
stateBorderColor = 'black'
) +
tmap::tm_layout(
frame = TRUE,
frame.double.line = TRUE,
bg.color = "grey85",
inner.margins = .05
) +
tmap::tm_title(
text = 'Obesity Rate by State',
size = 1.5,
position = tmap::tm_pos_in("center", "top"),
fontfamily = "serif"
)
# Example using stateCode
stateMap(
data = example_US_stateObesity,
parameter = "obesityRate",
stateCode = c('ME', 'NH', 'VT', 'MA', 'RI', 'CT'),
stateBorderColor = 'black',
legendPosition = tmap::tm_pos_in("right", "bottom")
) +
tmap::tm_layout(
frame = TRUE,
frame.double.line = TRUE,
bg.color = "grey85",
inner.margins = .08
) +
tmap::tm_title(
text = 'Obesity Rates in New England',
size = 1.5,
fontface = 2,
fontfamily = "serif",
position = tmap::tm_pos_in("center", "top")
)
Run the code above in your browser using DataLab