Set or retrieve default values used in mapping functions availables in mapping package.
mapping.options(...)
Return a list with options.
A single character vector, or a named list. The form name = value
can be used to change a single option or list(name1 = value1, name2 = value2)
can be used to change several arguments. If no arguments are provided, then the function returns all the current options.
The function change globally the option for the current R session, and locally if used in the mapping
function, with the options
argument, for example, options = mapping.options(legend.frame = FALSE, "title.position" = "left")
.
Many different options are used for the function in tmap package. For more details, look at tm_layout
, tm_borders
, and tm_fill
.
Available options are the following:
palette.cont = "YlGnBu"
palette for countinuous data
palette.cat = "Accent"
palette for categorical data
palette.cont.vector = NULL
a string vector with color names for countinuous data
palette.cont.vector = NULL
a string vector with color names for categorical data
nclass = 5
number of classes for countinuous data
check.unit.names = TRUE
a ogical value indicating whether the input id names are checked before the link with the coordinates
use_cache = TRUE
a ogical value indicating whether the cache is used to load the shape file
use_internet = TRUE
a ogical value indicating whether the data are downloaded from internet or whether a internet connection is available
alpha = 1
transparency
breaks = NULL
a numerical value indicating the breaks
interval.closure = "left"
a ogical value indicating where the interval are closed
labels = NULL
a character vector with labels of the classes
NA.color = "grey"
color for NA
values
NA.text = "Missing"
label for NA
values
col.style = "order"
type of color scale for numeric data. For other method look ad tm_fill
map.frame = TRUE
a logical value indicating whether the frame is drawn
border.lwd = 1
line width of the borders
border.col = "black"
color of the borders
border.type = "solid"
border type
border.alpha = NA
trasparency of the borders
title = NULL
main title
title.position = "center"
main title position
title.color = "black"
color of main title
title.fontface = 1
main title font face
title.size = 1
main title size
legend.title = NA
title of the legend
legend.show = TRUE
a logical value indicating whether include the legend
legend.only = FALSE
a logical value indicating whether include the legend without map
legend.position = c("right","top")
legend position
legend.digits = 5
legend digits
legend.outside = FALSE
a logical value indicating whether the legend is included outside the map
legend.outside.facetes = TRUE
a logical value indicating whether the legend is included outside the facetes
legend.width = 1
width of the legend
legend.title.position = c("right","top")
legend title position
legend.title.size = 1
legend title size
legend.title.fontface = 1
legend title font space
legend.title.color = "black"
legend title color
legend.text.color = "black"
legend title color
legend.text.size = 0.5
legend title color size
legend.text.align = "left"
legend.text.fontface = 1
legend.frame = TRUE
a logical value indicating whether the frame is drawn for the legend
legend.decimal.mark = "."
legend.format = "fg"
legend.big.mark = ","
legend.text.separator = "-"
facets.free.scale = FALSE
facetes.cols = NA
facetes.rows = NA
interactive.tiles = "CartoDB.Positron"
interactive.popup.vars = NULL
interactive.popup.id = TRUE
interactive.popup.closeButton = TRUE
interactive.popup.width.max = 150
interactive.popup.width.min = 35
interactive.highlight.weight = 3
interactive.highlight.color = "black"
interactive.highlight.alpha = 1
interactive.highlight.front = TRUE
interactive.control.collapse = TRUE
interactive.layer.control.position = c("left", "top")
interactive.hovered.id = TRUE
text.size = 0.5
text.col = "black"
text.fontface = 1
text.shadow = FALSE
text.alpha = NA
credits.source = NULL
credits.author = NULL
credits.size = 0.7
credits.fontface = NA
credits.color = "black"
credits.align = "left"
credits.position = c("left", "bottom")
popup.vars = NA
a character vector indicating the variable to popoup in interactive maps
compass = NULL
a character vector indicatin the type of compass (look at tm_layout
)
style = "white"
style (look at tm_style
)
crs = NULL
Options may be reset using mapping.options()
.
Tennekes M (2018). “tmap: Thematic Maps in R.” _Journalstatisticaltical Software_, *84*(6), 1-39. doi: 10.18637/jss.v084.i06 (URL: https://doi.org/10.18637/jss.v084.i06).
mapping.options()
# A single options
mapping.options("title.position")
# Globally
mapping.options("title.position" = "left")
mapping.options("title.position")
Run the code above in your browser using DataLab