Skip to contents

Set or retrieve default values used in mapping functions availables in mapping package.

Usage

mapping.options(...)

Arguments

...

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.

Details

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().

Value

Return a list with options.

References

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).

Examples



mapping.options()
#> $palette.cont
#> [1] "YlGnBu"
#> 
#> $palette.cat
#> [1] "Accent"
#> 
#> $nclass
#> [1] 5
#> 
#> $check.unit.names
#> [1] TRUE
#> 
#> $use_cache
#> [1] TRUE
#> 
#> $use_internet
#> [1] TRUE
#> 
#> $alpha
#> [1] 0.8
#> 
#> $breaks
#> NULL
#> 
#> $interval.closure
#> [1] "left"
#> 
#> $labels
#> NULL
#> 
#> $NA.color
#> [1] "grey"
#> 
#> $NA.text
#> [1] "Missing"
#> 
#> $col.style
#> [1] "cont"
#> 
#> $map.frame
#> [1] FALSE
#> 
#> $border.lwd
#> [1] 0.5
#> 
#> $border.col
#> [1] "black"
#> 
#> $border.type
#> [1] "solid"
#> 
#> $border.alpha
#> [1] 0.8
#> 
#> $title
#> NULL
#> 
#> $title.position
#> [1] "left"
#> 
#> $title.color
#> [1] "black"
#> 
#> $title.fontface
#> [1] 1
#> 
#> $title.size
#> [1] 1
#> 
#> $legend.title
#> [1] NA
#> 
#> $legend.show
#> [1] TRUE
#> 
#> $legend.only
#> [1] FALSE
#> 
#> $legend.position
#> [1] "right" "top"  
#> 
#> $legend.portrait
#> [1] TRUE
#> 
#> $legend.digits
#> [1] 3
#> 
#> $legend.outside
#> [1] FALSE
#> 
#> $legend.outside.facetes
#> [1] FALSE
#> 
#> $legend.width
#> [1] 0.7
#> 
#> $legend.title.position
#> [1] "right" "top"  
#> 
#> $legend.title.size
#> [1] 0.7
#> 
#> $legend.title.fontface
#> [1] 1
#> 
#> $legend.title.color
#> [1] "black"
#> 
#> $legend.text.color
#> [1] "black"
#> 
#> $legend.text.size
#> [1] 0.7
#> 
#> $legend.text.align
#> [1] "left"
#> 
#> $legend.text.fontface
#> [1] 1
#> 
#> $legend.frame
#> [1] FALSE
#> 
#> $legend.decimal.mark
#> [1] "."
#> 
#> $legend.format
#> [1] "fg"
#> 
#> $legend.big.mark
#> [1] ","
#> 
#> $legend.text.separator
#> [1] "-"
#> 
#> $facets.free.scale
#> [1] FALSE
#> 
#> $facetes.cols
#> [1] NA
#> 
#> $facetes.rows
#> [1] NA
#> 
#> $interactive.tiles
#> [1] "CartoDB.Positron"
#> 
#> $interactive.popup.vars
#> NULL
#> 
#> $interactive.popup.id
#> [1] TRUE
#> 
#> $interactive.popup.closeButton
#> [1] TRUE
#> 
#> $interactive.popup.width.max
#> [1] 150
#> 
#> $interactive.popup.width.min
#> [1] 35
#> 
#> $interactive.highlight.weight
#> [1] 3
#> 
#> $interactive.highlight.color
#> [1] "black"
#> 
#> $interactive.highlight.alpha
#> [1] 1
#> 
#> $interactive.highlight.front
#> [1] TRUE
#> 
#> $interactive.control.collapse
#> [1] TRUE
#> 
#> $interactive.layer.control.position
#> [1] "left" "top" 
#> 
#> $interactive.hovered.id
#> [1] TRUE
#> 
#> $text.size
#> [1] 0.5
#> 
#> $text.col
#> [1] "black"
#> 
#> $text.fontface
#> [1] 1
#> 
#> $text.shadow
#> [1] FALSE
#> 
#> $text.alpha
#> [1] NA
#> 
#> $credits.source
#> NULL
#> 
#> $credits.author
#> NULL
#> 
#> $credits.size
#> [1] 0.7
#> 
#> $credits.fontface
#> [1] NA
#> 
#> $credits.color
#> [1] "black"
#> 
#> $credits.align
#> [1] "left"
#> 
#> $credits.position
#> [1] "left"   "bottom"
#> 
#> $background.color
#> [1] "grey85"
#> 
#> $popup.vars
#> [1] NA
#> 
#> $compass
#> NULL
#> 
#> $style
#> [1] "white"
#> 
#> $crs
#> [1] "+init=epsg:4326"
#> 

# A single options

mapping.options("title.position")
#> [1] "left"

# Globally

mapping.options("title.position" = "left")
mapping.options("title.position")
#> [1] "left"