Title: | Thematic Maps |
Version: | 4.1 |
Description: | Thematic maps are geographical maps in which spatial data distributions are visualized. This package offers a flexible, layer-based, and easy to use approach to create thematic maps, such as choropleths and bubble maps. |
License: | GPL-3 |
URL: | https://github.com/r-tmap/tmap, https://r-tmap.github.io/tmap/ |
BugReports: | https://github.com/r-tmap/tmap/issues |
Depends: | R (≥ 4.1) |
Imports: | classInt (≥ 0.4-3), cli, cols4all (≥ 0.8), data.table, grid, htmltools, htmlwidgets, base64enc, leafem (≥ 0.2.4), leafgl, leaflegend, leaflet (≥ 2.0.2), leafsync, maptiles, methods, rlang, sf (≥ 0.9-3), stars (≥ 0.4-2), stats, s2, tmaptools (≥ 3.1), units (≥ 0.6-1), servr |
Suggests: | av, transformr, colorspace, ggplot2, gifski, knitr, shiny, terra, testthat (≥ 3.2.0), widgetframe, lobstr, rsvg, rstudioapi |
Config/Needs/check: | Nowosad/spDataLarge, lwgeom, r-tmap/tmap |
Config/Needs/coverage: | Nowosad/spDataLarge, lwgeom, r-tmap/tmap |
Config/Needs/website: | bookdown, rmarkdown, r-tmap/tmap, sfnetworks |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-05-12 08:27:15 UTC; mtes |
Author: | Martijn Tennekes [aut, cre], Jakub Nowosad [ctb], Joel Gombin [ctb], Sebastian Jeworutzki [ctb], Kent Russell [ctb], Richard Zijdeman [ctb], John Clouse [ctb], Robin Lovelace [ctb], Jannes Muenchow [ctb], Olivier Roy [ctb], Edzer Pebesma [ctb], Hugh Graham [ctb], Michael D. Sumner [ctb], Tim Appelhans [ctb], Nick Bearman [ctb], Pukar Bhandari [ctb], Stéphane Guillou [ctb], Monika Anna Tomaszewska [ctb], Ajoke Onojeghuo [ctb], Jerome Guelat [ctb] |
Maintainer: | Martijn Tennekes <mtennekes@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-05-12 17:40:02 UTC |
Thematic Map Visualization
Description
Thematic maps are geographical maps in which spatial data distributions are visualized. This package offers a flexible, layer-based, and easy to use approach to create thematic maps, such as choropleths and bubble maps. It is based on the grammar of graphics, and resembles the syntax of ggplot2.
Author(s)
Martijn Tennekes mtennekes@gmail.com
References
Tennekes, M., 2018, tmap: Thematic Maps in R, Journal of Statistical Software, 84(6), 1-39, doi:10.18637/jss.v084.i06
See Also
Get basemap tiles providers
Description
Get basemap tiles providers and the credits (attribution text). tmap_providers()
returns a list (or vector) with provider nams (or credits). tmap_provider_credits()
Usage
.tmap_providers
tmap_provider_credits(provider)
tmap_providers(mode, credits = FALSE, as.list = credits)
Arguments
provider |
provider name |
mode |
mode. If not specified the default mode is used |
credits |
If |
as.list |
Should the output be returned as list where names are provider names? By default |
Format
An object of class environment
of length 44.
Value
list or vector (see as.list
) with providers (or credits). tmap_provider_credits()
returns the credits text for the provided provider.
Netherlands datasets
Description
Datasets of the Netherlands for 2022 at three levels: NLD_prov
(12) provinces, NLD_muni
(345) municipalities and NLD_dist
(3340) districts , all class sf
Usage
NLD_prov
NLD_muni
NLD_dist
Details
The data variables for NLD_muni
and NLD_dist
are identical:
Variable | Description |
code | Code. Format is "GMaaaa" (municipality/'gemeente') and "WKaaaabb" (district/wijk). Here, "aaaa" represents the municipality id number, and "bb" the additional district number. |
name | Name. |
province | Province name. |
area | Total area in km2. This area corresponds to the area of the polygons (including inland waters, excluding coastal waters), but is more precise because it is based on non-simplified geometries. |
urbanity | Level of urbanity. Five classes, determined by the number of addresses per km2 (break values are 2500, 1500, 1000, and 500). |
population | The total population count at 2022-01-01. |
pop_0_14 | Percentage (rounded) of people between 0 and 15. |
pop_15_24 | Percentage (rounded) of people between 15 and 25. |
pop_25_44 | Percentage (rounded) of people between 25 and 45. |
pop_45_64 | Percentage (rounded) of people between 45 and 65. |
pop_65plus | Percentage (rounded) of people of 65 and older. |
dwelling_total | Number of dwellings. |
dwelling_value | Average dwelling value (Dutch: WOZ-value). |
dwelling_ownership | Percentage of dwellings owned by the residents. |
employment_rate | Share of the employed population within the total population from 15 to 75 years old. |
income_low | Percentage of individuals in private households belonging to the lowest 40% of personal income nationwide. |
income_high | Percentage of individuals in private households belonging to the highest 20% of personal income nationwide. |
edu_appl_sci | Percentage of people aged 15 to 75 with a university of applied sciences (Dutch: HBO) or university (Dutch: WO) degree. |
See source for detailed information about the variables.
This dataset, created Noveber 2024, is an update from the datasets NLD_muni
and NLD_prov
used in tmap <= 3, which has been created around 2016. Note that the number of municipalities have been reduced (due to mergings). All old variables are included, except for variables related to ethnicity. Many new variable have been added, and moreover, district (Dutch: wijk) level data have added: NLD_dist
.
The CRS (coordinate reference system) used is the Rijksdriekhoekstelsel New, EPSG 28992. Coordinates have been rounded to meters to reduce file size.
Source
https://www.cbs.nl/nl-nl/maatwerk/2024/11/kerncijfers-wijken-en-buurten-2022
References
Statistics Netherlands (2024), The Hague/Heerlen, Netherlands, https://www.cbs.nl/.
World dataset
Description
World dataset, class sf
Usage
World
Details
Variable | Source | Description |
iso_a3 | NED | ISO 3166-1 alpha-3 three-letter country code (see below) |
name | NED | Country name |
sovereignt | NED | Sovereignt country name |
continent | NED | Continent (primary; some countries are transcontinental) |
area | NED | Area in km2 |
pop_est | NED | Population estimation |
pop_est_dens | NED | Population estimation per km2 |
economy | NED | Economy class |
income_grp | NED | Income group |
gdp_cap_est | NED | GDP per capita (estimated) |
life_exp | HPI | Life expectancy. The average number of years an infant born in that country is expected to live |
well_being | HPI | Well being. Self-reported from 0 (worst) to 10 (best) |
footprint | HPI | Carbon footprint. Per capita greendwelling gas emissions associated with consumption and economic activity |
HPI | HPI | Happy Planet Indicator. An index of human well-being and environmental impact that was introduced by the New Economics Foundation in 2006. Approximate formula: (life_exp * well_being) / footprint |
inequality | WB | Income inequality: Gini coefficient (World Bank variable SI.POV.GINI) A value of 0 represents perfect equality, while 100 implies perfect inequality |
gender | UNDP/OWiD | Gender Inequality Index (GII) Composite metric using reproductive health, empowerment and the labour market. A low value indicates low inequality between women and men, and vice-versa |
press | RSF | World Press Freedom Index. Degree of freedom that journalists, news organizations and netizens have |
See sources for more detailed information about the variables.
This dataset, created Noveber 2024, is an update from the old version, which has been created around 2016. All variables from the old version are included, but updated. Furthermore, gender ineuqlity and press freedom have been added.
ISO country-code: two countries have user-assigned codes, namely: XKX is used for Kosovo (conform European Union and World Bank) (was UNK in the old version); XNC is used for Northern Cyprus (was CYN in the old version).
For some variables data were available from multiple years, but availability was different across countries. In those cases, the most recent values were taken.
Source
NED: Natural Earth Data https://www.naturalearthdata.com/
HPI: Happy Planet Index https://happyplanetindex.org/
UNDP: Human Development Report (2024) https://hdr.undp.org/content/human-development-report-2023-24
WB: World Bank https://data.worldbank.org
OWiD: Our World in Data https://ourworldindata.org
RSF: Reporters Without Borders https://rsf.org/en/index
Spatial data of rivers
Description
Spatial data of rivers
Usage
World_rivers
Format
An object of class sf
(inherits from data.frame
) with 1632 rows and 5 columns.
Note
In tmap <= 3, this dataset was called rivers
.
Source
https://www.naturalearthdata.com
Internal tmap function that gets factor levels with NA's
Description
Internal tmap function that gets factor levels with NA's
Usage
get_fact_levels_na(x, o)
Arguments
x |
vector |
o |
options |
Internal tmap function get scale values
Description
Internal tmap function get scale values
Usage
get_scale_defaults(scale, o, aes, layer, cls, ct = NULL)
Arguments
scale |
scale |
o |
o |
aes |
aes |
layer |
layer |
cls |
cls |
ct |
ct |
Spatial data of global land cover
Description
Spatial data of global land cover, percent tree cover, and elevation of class stars
.
Two attributes in this object relates to global land cover.
The cover layer classifies the status of land cover of the whole globe into 20 categories, while
the cover_cls layer uses 8 simplified categories.
Percent Tree Cover (trees) represents the density of trees on the ground, and the last attribute represents elevation.
Usage
land
Format
An object of class stars
with 1080 rows and 540 columns.
Details
Important: publication of these maps is only allowed when cited to Tateishi et al. (2014), and when "Geospatial Information Authority of Japan, Chiba University and collaborating organizations." is shown.
References
Production of Global Land Cover Data - GLCNMO2008, Tateishi, R., Thanh Hoan, N., Kobayashi, T., Alsaaideh, B., Tana, G., Xuan Phong, D. (2014), Journal of Geography and Geology, 6 (3).
Internal tmap function to create by variables (used for faceting)
Description
Internal tmap function to create by variables (used for faceting)
Usage
make_by_vars(dt, tmf, smeta)
Arguments
dt |
data.table |
tmf |
tmf object |
smeta |
smeta object |
Spatial data of metropolitan areas
Description
metro
includes a population time series from 1950 to (forecasted) 2030. All metro areas with over 1 million inhabitants in 2010 are included.
Usage
metro
Format
An object of class sf
(inherits from data.frame
) with 436 rows and 13 columns.
Source
https://population.un.org/wup/
References
United Nations, Department of Economic and Social Affairs, Population Division (2014). World Urbanization Prospects: The 2014 Revision, CD-ROM Edition.
Print tm_element
Description
Print tm_element
Usage
## S3 method for class 'tm_element'
print(x, ...)
## S3 method for class 'tm_shape'
print(x, ...)
Arguments
x |
x |
... |
passed on |
Draw thematic map
Description
Draw thematic map
Usage
## S3 method for class 'tmap'
print(
x,
return.asp = FALSE,
show = TRUE,
vp = NULL,
knit = FALSE,
options = NULL,
in.shiny = FALSE,
proxy = FALSE,
...
)
## S3 method for class 'tmap'
knit_print(x, ..., options = NULL)
Arguments
x |
tmap object. |
return.asp |
should the aspect ratio be returned? |
show |
show the map |
vp |
viewport (for |
knit |
A logical, should knit? |
options |
A vector of options |
in.shiny |
A logical, is the map drawn in shiny? |
proxy |
A logical, if |
... |
passed on internally (for developers: in |
Quick thematic map plot
Description
Draw a thematic map quickly. This function is a convenient wrapper of the main
plotting method of stacking tmap-element
s. Without arguments or with a
search term, this functions draws an interactive map.
Usage
qtm(
shp = NULL,
fill = tmap::tm_const(),
col = tmap::tm_const(),
size = tmap::tm_const(),
shape = tmap::tm_const(),
lwd = tmap::tm_const(),
lty = tmap::tm_const(),
fill_alpha = tmap::tm_const(),
col_alpha = tmap::tm_const(),
text = tmap::tm_const(),
text_col = tmap::tm_const(),
text_size = tmap::tm_const(),
by = NULL,
scale = NULL,
title = NULL,
crs = NULL,
bbox = NULL,
basemaps = NA,
overlays = NA,
zindex = NA,
group = NA,
group.control = "check",
style = NULL,
format = NULL,
...
)
Arguments
shp |
One of:
|
fill , col , size , shape , lwd , lty , fill_alpha , col_alpha |
Visual variables. |
text , text_col , text_size |
Visual variables. |
by |
data variable name by which the data is split, or a vector of two
variable names to split the data by two variables (where the first is used
for the rows and the second for the columns). See also |
scale |
numeric value that serves as the global scale parameter. All font
sizes, symbol sizes, border widths, and line widths are controlled by this value.
The parameters |
title |
main title. For legend titles, use |
crs |
Either a |
bbox |
bounding box. Argument passed on to |
basemaps |
name(s) of the provider or an URL of a tiled basemap.
It is a shortcut to |
overlays |
name(s) of the provider or an URL of a tiled overlay map.
It is a shortcut to |
zindex |
zindex |
group |
group |
group.control |
group.control |
style |
Layout options (see |
format |
Deprecated, see |
... |
arguments associated with the visual variables are passed on
to the layer functions |
Details
The first argument is a shape object (normally specified by tm_shape()
).
The next arguments, from fill
to raster
, are the aesthetics from the main
layers. The remaining arguments are related to the map layout. Any argument
from any main layer function, such as tm_polygons()
, can be specified (see ...
).
It is also possible to stack tmap-element
s on a qtm
plot. See examples.
By default, a scale bar is shown. This option can be set with tmap_options()
(argument qtm.scalebar
). A minimap is shown by default when qtm
is called
without arguments of with a search term. This option can be set with tmap_options()
(argument qtm.minimap
).
Value
References
Tennekes, M., 2018, tmap: Thematic Maps in R, Journal of Statistical Software, 84(6), 1-39, doi:10.18637/jss.v084.i06
Examples
data(World, World_rivers, metro)
# just the map
qtm(World)
# choropleth
qtm(World, fill = "economy", style = "cobalt", crs = "+proj=eck4")
qtm(World, col = NULL) +
qtm(metro, size = "pop2010",
size.legend = tm_legend("Metropolitan Areas"))
# dot map
## Not run:
current.mode <- tmap_mode("view")
qtm(metro, bbox = "China")
tmap_mode(current.mode) # restore mode
## End(Not run)
## Not run:
# without arguments, a plain interactive map is shown (the mode is set to view)
qtm()
# search query for OpenStreetMap nominatim
qtm("Amsterdam")
## End(Not run)
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
- leaflet
Wrapper functions for using tmap in shiny
Description
-
tmapOutput()
creates a UI element -
renderTmap()
renders a tmap map -
tmapProxy()
updates a tmap map inview
mode
Adding layers is as usual via the map layer functions like tm_polygons()
.
Removing layers can be done, removing with tm_remove_layer()
.
Usage
renderTmap(
expr,
env = parent.frame(),
quoted = FALSE,
execOnResize = TRUE,
mode = NA
)
tmapOutput(outputId, width = "100%", height = 400, mode = NA)
tmapProxy(mapId, session = shiny::getDefaultReactiveDomain(), x, mode = NA)
tm_remove_layer(zindex)
Arguments
expr |
A tmap object. A tmap object is created with |
env |
The environment in which to evaluate expr |
quoted |
Is |
execOnResize |
If |
mode |
tmap mode, see |
outputId |
Output variable to read from |
width , height |
the width and height of the map |
mapId |
single-element character vector indicating the output ID of the map to modify (if invoked from a Shiny module, the namespace will be added automatically) |
session |
the Shiny session object to which the map belongs; usually the default value will suffice |
x |
the tmap object that specifies the added and removed layers. |
zindex |
the z index of the pane in which the layer is contained that is going to be removed. It is recommended to specify the |
Details
Two features from tmap are not (yet) supported in Shiny: small multiples (facets) and colored backgrounds (argument bg.color
of tm_layout()
).
Workarounds for small multiples: create multiple independent maps or specify as.layers = TRUE
in tm_facets()
.
Examples
if (interactive() && require("shiny")) {
data(World)
world_vars <- setdiff(names(World), c("iso_a3", "name", "sovereignt", "geometry"))
current.mode <- tmap_mode("plot")
shinyApp(
ui = fluidPage(
tmapOutput("map", height = "600px"),
selectInput("var", "Variable", world_vars)
),
server <- function(input, output, session) {
output$map <- renderTmap({
tm_shape(World) +
tm_polygons(input$var, zindex = 401)
})
}
)
tmap_mode("view")
shinyApp(
ui = fluidPage(
tmapOutput("map", height = "600px"),
selectInput("var", "Variable", world_vars)
),
server <- function(input, output, session) {
output$map <- renderTmap({
tm_shape(World, id = "iso_a3") +
tm_polygons(fill = world_vars[1], zindex = 401)
})
observe({
var <- input$var
tmapProxy("map", session, {
tm_remove_layer(401) +
tm_shape(World, id = "iso_a3") +
tm_polygons(fill = var, zindex = 401)
})
})
},options = list(launch.browser=TRUE)
)
tmap_mode(current.mode)
}
Internal tmap function to create a tmap shape
Description
Internal tmap function to create a tmap shape
Usage
shapeTM(shp, tmapID = NULL, bbox = NULL, ...)
Arguments
shp |
Shape file |
tmapID |
tmap Identifier |
bbox |
bounding box |
ggplot2 theme for proportional symbols
Description
ggplot2 theme for proportional symbols. By default, this theme only shows the plotting area, so without titles, axes, and legend.
Usage
theme_ps(
base_size = 12,
base_family = "",
plot.axes = FALSE,
plot.legend = FALSE
)
Arguments
base_size |
base size |
base_family |
base family |
plot.axes |
should the axes be shown? |
plot.legend |
should the legend(s) be shown? |
Map component: manual legend
Description
Map component that adds a manual legend.
Usage
tm_add_legend(
...,
labels = "",
type = "symbols",
title = "",
design = NULL,
orientation = NULL,
position = NULL,
group_id = NA_character_,
group = NA,
group.control = "check",
z = NA_integer_
)
Arguments
... |
visual variables and arguments passed on to |
labels |
labels by default |
type |
the layer type from which the visual variables (see |
title |
The title of the legend. |
design |
The design of the legend. |
orientation |
The orientation of the legend. |
position |
The position of the legend. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how
layer groups can be switched on and off. Options: |
z |
z index, e.g. the place of the component relative to the other componets |
Examples
## Not run:
tm_shape(NLD_muni) +
tm_borders() +
tm_basemap("OpenStreetMap") +
tm_add_legend(labels = c("Motorway", "Primary road", "Secondary road", "Railway"),
col = c("#E892A1", "#FCD6A4", "#F8FABF", "#707070"),
lty = c("solid", "solid", "solid", "dotted"),
lwd = 3,
type = "lines",
bg.color = "grey92",
bg.alpha = 1)
## End(Not run)
Specify an animation (experimental)
Description
tm_animate
Usage
tm_animate(
by = "VARS__",
nframes = 60L,
fps = 20L,
play = c("loop", "pingpong", "once"),
dpr = 2,
...
)
tm_animate_slow(
by = "VARS__",
nframes = 60L,
fps = 2L,
play = c("loop", "pingpong", "once"),
dpr = 2,
...
)
Arguments
by |
group by variable used to create the animation frames. Note: it is called |
nframes |
number of animation frames. This only app |
fps |
frames per second. Default: 30 for |
play |
how should the animation be played? One of |
dpr |
device pixel ratio. The ratio between the physical pixel density of a device and its logical pixel density. |
... |
passed on to |
See Also
tm_facets()
which is the core function, and tmap_animation()
used to save the animation
Map layer: basemap / overlay tiles
Description
Map layer that draws tiles from a tile server. tm_basemap()
draws the tile
layer as basemap, i.e. as bottom layer. In contrast, tm_tiles()
draws the
tile layer as overlay layer, where the stacking order corresponds with the
order in which this layer is called, just like other map layers.
Usage
tm_basemap(
server = NA,
alpha = NULL,
zoom = NULL,
api = NULL,
max.native.zoom = 17,
sub = "abc",
zindex = 0,
group = NA,
group.control = "radio"
)
tm_tiles(
server = NA,
alpha = NULL,
zoom = NULL,
max.native.zoom = 17,
sub = "abc",
zindex = NA,
group = NA,
group.control = "check"
)
Arguments
server |
Name of the provider or an URL. The list of available providers
can be obtained with |
alpha |
Transparency level |
zoom |
Zoom level (only used in plot mode) |
api |
API key. Needed for |
max.native.zoom |
Maximum native zoom level (only used in view mode).
The minimum and maximum zoom levels are determined in |
sub |
subdomain of the tile server. Only used when |
zindex |
zindex of the pane in view mode. By default, it is set to the
layer number plus 400. By default, the tmap layers will therefore be placed
in the custom panes |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how layer
groups can be switched on and off. Options: |
Details
API keys. For Stadia and Thunderforest maps, an API key is required.
This can be set via the argument api
. Alternatively they can be stored in environment variables "STADIA_MAPS"
and THUNDERFOREST_MAPS
with Sys.setenv
See Also
Examples
## Not run:
if (requireNamespace("maptiles")) {
# view mode
current_mode = tmap_mode("view")
tm_basemap("Stadia.StamenWatercolor") +
tm_shape(World) +
tm_polygons(
"HPI",
fill.scale = tm_scale(values = "reds"),
fill_alpha.scale = 0.5)
tm_shape(World, crs = "+proj=eqearth") +
tm_polygons(
"HPI",
fill.scale = tm_scale(values = "reds"),
fill_alpha.scale = 0.5) +
tm_basemap(NULL)
# plot mode:
tmap_mode("plot")
tm_basemap() +
tm_shape(World) +
tm_polygons("HPI")
tm_basemap("OpenTopoMap") +
tm_shape(World) +
tm_polygons(fill = NA, col = "black")
tm_basemap("CartoDB.PositronNoLabels") +
tm_shape(NLD_prov, crs = 4236) +
tm_borders() +
tm_facets_wrap("name") +
tm_tiles("CartoDB.PositronOnlyLabels")
# restore mode
tmap_mode(current_mode)
}
## End(Not run)
Legend charts
Description
Legend charts are small charts that are added to the map, usually in addition to legends.
Usage
tm_chart_histogram(
breaks,
plot.axis.x,
plot.axis.y,
extra.ggplot2,
position,
group_id,
width,
height,
stack,
z,
...
)
tm_chart_bar(
plot.axis.x,
plot.axis.y,
extra.ggplot2,
position,
group_id,
width,
height,
stack,
z,
...
)
tm_chart_donut(position, group_id, width, height, stack, z, ...)
tm_chart_violin(position, group_id, width, height, stack, z, ...)
tm_chart_box(position, group_id, width, height, stack, z, ...)
tm_chart_none()
tm_chart_heatmap(position, group_id, width, height, stack, z, ...)
Arguments
breaks |
The breaks of the bins (for histograms) |
plot.axis.x , plot.axis.y |
Should the x axis and y axis be plot? |
extra.ggplot2 |
Extra ggplot2 code |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
width , height |
width and height of the component. |
stack |
stack with other map components, either |
z |
z index, e.g. the place of the component relative to the other componets |
... |
passed on to |
Details
Note that these charts are different from charts drawn inside the map. Those are called glyphs (to be implemented).
See Also
Examples
tm_shape(World) +
tm_polygons("HPI",
fill.scale = tm_scale_intervals(),
fill.chart = tm_chart_histogram())
tmap options
Description
Get or set the tmap options globally. For map specific options, we recommend to use tm_options()
or tm_layout()
via which the layout-related options can be set. tmap_options()
functions similar to base::options()
.
Usage
tm_check_fix()
tmap_options(
...,
crs,
facet.max,
facet.flip,
free.scales,
raster.max_cells,
raster.warp,
show.messages,
show.warnings,
output.format,
output.size,
output.dpi,
animation.dpi,
value.const,
value.na,
value.null,
value.blank,
values.var,
values.range,
value.neutral,
values.scale,
scales.var,
scale.misc.args,
continuous.nclass_per_legend_break,
continuous.nclasses,
label.format,
label.na,
scale,
asp,
bg,
bg.color,
outer.bg,
outer.bg.color,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
frame.double_line,
outer.margins,
inner.margins,
inner.margins.extra,
meta.margins,
meta.auto_margins,
between_margin,
panel.margin,
grid.mark.height,
xylab.height,
coords.height,
xlab.show,
xlab.text,
xlab.size,
xlab.color,
xlab.rotation,
xlab.space,
xlab.fontface,
xlab.fontfamily,
xlab.alpha,
xlab.side,
ylab.show,
ylab.text,
ylab.size,
ylab.color,
ylab.rotation,
ylab.space,
ylab.fontface,
ylab.fontfamily,
ylab.alpha,
ylab.side,
panel.type,
panel.wrap.pos,
panel.xtab.pos,
unit,
color.sepia_intensity,
color.saturation,
color_vision_deficiency_sim,
text.fontface,
text.fontfamily,
text.alpha,
component.position,
component.offset,
component.stack_margin,
component.autoscale,
component.resize_as_group,
component.frame_combine,
component.stack,
legend.stack,
chart.stack,
component.equalize,
component.frame,
component.frame.color,
component.frame.alpha,
component.frame.lwd,
component.frame.r,
component.bg,
component.bg.color,
component.bg.alpha,
legend.show,
legend.design,
legend.orientation,
legend.position,
legend.width,
legend.height,
legend.reverse,
legend.na.show,
legend.title.color,
legend.title.size,
legend.title.fontface,
legend.title.fontfamily,
legend.title.alpha,
legend.xlab.color,
legend.xlab.size,
legend.xlab.fontface,
legend.xlab.fontfamily,
legend.xlab.alpha,
legend.ylab.color,
legend.ylab.size,
legend.ylab.fontface,
legend.ylab.fontfamily,
legend.ylab.alpha,
legend.text.color,
legend.text.size,
legend.text.fontface,
legend.text.fontfamily,
legend.text.alpha,
legend.frame,
legend.frame.color,
legend.frame.alpha,
legend.frame.lwd,
legend.frame.r,
legend.bg,
legend.bg.color,
legend.bg.alpha,
legend.only,
legend.absolute_fontsize,
legend.settings.standard.portrait,
legend.settings.standard.landscape,
add_legend.position,
chart.show,
chart.plot.axis.x,
chart.plot.axis.y,
chart.position,
chart.width,
chart.height,
chart.reverse,
chart.na.show,
chart.title.color,
chart.title.size,
chart.title.fontface,
chart.title.fontfamily,
chart.title.alpha,
chart.xlab.color,
chart.xlab.size,
chart.xlab.fontface,
chart.xlab.fontfamily,
chart.xlab.alpha,
chart.ylab.color,
chart.ylab.size,
chart.ylab.fontface,
chart.ylab.fontfamily,
chart.ylab.alpha,
chart.text.color,
chart.text.size,
chart.text.fontface,
chart.text.fontfamily,
chart.text.alpha,
chart.frame,
chart.frame.color,
chart.frame.alpha,
chart.frame.lwd,
chart.frame.r,
chart.bg,
chart.bg.color,
chart.bg.alpha,
chart.object.color,
title.size,
title.color,
title.fontface,
title.fontfamily,
title.alpha,
title.padding,
title.frame,
title.frame.color,
title.frame.alpha,
title.frame.lwd,
title.frame.r,
title.position,
title.width,
credits.size,
credits.color,
credits.fontface,
credits.fontfamily,
credits.alpha,
credits.padding,
credits.position,
credits.width,
credits.height,
compass.north,
compass.type,
compass.text.size,
compass.size,
compass.show.labels,
compass.cardinal.directions,
compass.text.color,
compass.color.dark,
compass.color.light,
compass.lwd,
compass.margins,
compass.position,
inset.position,
logo.height,
logo.margins,
logo.between_margin,
logo.position,
inset_map.height,
inset_map.width,
inset_map.margins,
inset_map.between_margin,
inset_map.position,
inset_map.frame,
inset.height,
inset.width,
inset.margins,
inset.between_margin,
inset.frame,
inset.bg,
inset.bg.color,
inset.bg.alpha,
inset_grob.height,
inset_grob.width,
inset_gg.height,
inset_gg.width,
scalebar.breaks,
scalebar.width,
scalebar.allow_clipping,
scalebar.text.size,
scalebar.text.color,
scalebar.text.fontface,
scalebar.text.fontfamily,
scalebar.color.dark,
scalebar.color.light,
scalebar.lwd,
scalebar.size,
scalebar.margins,
scalebar.position,
grid.show,
grid.labels.pos,
grid.x,
grid.y,
grid.n.x,
grid.n.y,
grid.crs,
grid.col,
grid.lwd,
grid.alpha,
grid.labels.show,
grid.labels.size,
grid.labels.col,
grid.labels.fontface,
grid.labels.fontfamily,
grid.labels.rot,
grid.labels.format,
grid.labels.cardinal,
grid.labels.margin.x,
grid.labels.margin.y,
grid.labels.space.x,
grid.labels.space.y,
grid.labels.inside_frame,
grid.ticks,
grid.lines,
grid.ndiscr,
mouse_coordinates.position,
minimap.server,
minimap.toggle,
minimap.position,
panel.show,
panel.labels,
panel.label.size,
panel.label.color,
panel.label.fontface,
panel.label.fontfamily,
panel.label.alpha,
panel.label.bg,
panel.label.bg.color,
panel.label.bg.alpha,
panel.label.frame,
panel.label.frame.color,
panel.label.frame.alpha,
panel.label.frame.lwd,
panel.label.frame.r,
panel.label.height,
panel.label.rot,
qtm.scalebar,
qtm.minimap,
qtm.mouse_coordinates,
earth_boundary,
earth_boundary.color,
earth_boundary.lwd,
earth_datum,
space.color,
check_and_fix,
basemap.show,
basemap.server,
basemap.alpha,
basemap.zoom,
tiles.show,
tiles.server,
tiles.alpha,
tiles.zoom,
attr.color,
crs_extra,
crs_global,
crs_basemap,
use_gradient,
use_browser,
use_WebGL,
control.position,
control.bases,
control.overlays,
control.collapse,
set_bounds,
set_view,
set_zoom_limits,
use_circle_markers,
leaflet.options,
title = NULL,
main.title = NULL,
main.title.size = NULL,
main.title.color = NULL,
main.title.fontface = NULL,
main.title.fontfamily = NULL,
main.title.position = NULL,
fontface = NULL,
fontfamily = NULL
)
tmap_options_mode(
mode = NA,
style = NULL,
mode.specific = TRUE,
default.options = FALSE
)
tmap_options_diff()
tmap_options_reset()
tmap_options_save(style)
Arguments
... |
List of tmap options to be set, or option names (characters) to be returned (see details) |
crs |
Map crs (see |
facet.max |
Maximum number of facets |
facet.flip |
Should facets be flipped (in case of facet wrap)? This can also be set via |
free.scales |
For backward compatibility: if this value is set, it will be used to impute the free arguments in the layer functions |
raster.max_cells |
Maximum number of raster grid cells. Can be mode specific |
raster.warp |
Should rasters be warped or transformed in case a different projection (crs) is used? Warping creates a new regular raster in the target crs, whereas transforming creates a (usually non-regular) raster in the target crs. The former is lossy, but much faster and is therefore the default. When a different projection (crs) is used, a (usually) regular raster will be |
show.messages |
Show messages? |
show.warnings |
Show warnings? |
output.format |
Output format |
output.size |
Output size |
output.dpi |
Output dpi |
animation.dpi |
Output dpi for animations |
value.const |
Default visual value constants e.g. the default fill color for |
value.na |
Default visual values that are used to visualize NA data values. A list is required with per visual variable a value. |
value.null |
Default visual values that are used to visualize null (out-of-scope) data values. A list is required with per visual variable a value. |
value.blank |
Default visual values that correspond to blank. For color these are |
values.var |
Default values when a data variable to mapped to a visual variable, e.g. a color palette. A list is required with per visual variable a value. |
values.range |
Default range for values. See |
value.neutral |
Default values for when a data variable to mapped to a visual variable, e.g. a color palette. A list is required with per visual variable a value. |
values.scale |
Default scales (as in object sizes) for values. See |
scales.var |
Default scale functions per visual variable and type of data variable. A list is required with per visual variable per data type. |
scale.misc.args |
Default values of scale function-specific arguments. A list is required with per scale function and optional per visual variable. |
continuous.nclass_per_legend_break |
The number of continuous legend breaks within one 'unit' (label). The default value is 50. |
continuous.nclasses |
the number of classes of a continuous scale. Should be odd. The default value is 101. |
label.format |
Format for the labels (was |
label.na |
Default label for missing values. |
scale |
Overall scale of the map |
asp |
Aspect ratio of each map. When |
bg |
Draw map background? |
bg.color |
Background color of the map. |
outer.bg |
Draw map background (outside the frame)? |
outer.bg.color |
Background color of map outside the frame. |
frame |
Draw map frame? |
frame.color |
The color of the frame. |
frame.alpha |
The alpha transparency of the frame. |
frame.lwd |
The line width of the frame. See |
frame.r |
The r (radius) of the frame. |
frame.double_line |
The double line of the frame. |
outer.margins |
The margins of the outer space (outside the frame. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inner.margins |
The margins of the inner space (inside the frame). A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inner.margins.extra |
The extra arguments of the margins of the inner space (inside the frame). A list of arguments. |
meta.margins |
The margins of the meta. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
meta.auto_margins |
The auto_margins of the meta. |
between_margin |
Margin between the map. |
panel.margin |
The margin of the panel. |
grid.mark.height |
The height of the mark of the grid. |
xylab.height |
The height of the xylab. |
coords.height |
The height of the coords. |
xlab.show |
The visibility of the xlab. |
xlab.text |
The text of the xlab. |
xlab.size |
The size of the xlab. |
xlab.color |
The color of the xlab. |
xlab.rotation |
The rotation of the xlab. |
xlab.space |
The space of the xlab. In terms of number of text line heights. |
xlab.fontface |
The font face of the xlab. See |
xlab.fontfamily |
The font family of the xlab. See |
xlab.alpha |
The alpha transparency of the xlab. |
xlab.side |
The side of the xlab. |
ylab.show |
The visibility of the ylab. |
ylab.text |
The text of the ylab. |
ylab.size |
The size of the ylab. |
ylab.color |
The color of the ylab. |
ylab.rotation |
The rotation of the ylab. |
ylab.space |
The space of the ylab. In terms of number of text line heights. |
ylab.fontface |
The font face of the ylab. See |
ylab.fontfamily |
The font family of the ylab. See |
ylab.alpha |
The alpha transparency of the ylab. |
ylab.side |
The side of the ylab. |
panel.type |
The type of the panel. |
panel.wrap.pos |
The panel positions for wrapped facets created with |
panel.xtab.pos |
The panel positions for grid facets created with |
unit |
Unit of the coordinate |
color.sepia_intensity |
The sepia_intensity of the color. |
color.saturation |
The saturation of the color. |
color_vision_deficiency_sim |
'Color vision deficiency simulation |
text.fontface |
The font face of the text. See |
text.fontfamily |
The font family of the text. See |
text.alpha |
The alpha transparency of the text. |
component.position |
The position of the component. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
component.offset |
The offset of the component. |
component.stack_margin |
The stack_margin of the component. |
component.autoscale |
The autoscale of the component. |
component.resize_as_group |
The resize_as_group of the component. |
component.frame_combine |
The frame_combine of the component. |
component.stack |
The stack of the component. |
legend.stack |
The stack of the legend. |
chart.stack |
The stack of the chart. |
component.equalize |
The equalize of the component. |
component.frame |
The frame of the component. |
component.frame.color |
The color of the frame of the component. |
component.frame.alpha |
The alpha transparency of the frame of the component. |
component.frame.lwd |
The line width of the frame of the component. See |
component.frame.r |
The r (radius) of the frame of the component. |
component.bg |
The bg of the component. |
component.bg.color |
The color of the bg of the component. |
component.bg.alpha |
The alpha transparency of the bg of the component. |
legend.show |
The visibility of the legend. |
legend.design |
The design of the legend. |
legend.orientation |
The orientation of the legend. |
legend.position |
The position of the legend. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
legend.width |
The width of the legend. |
legend.height |
The height of the legend. |
legend.reverse |
The reverse of the legend. |
legend.na.show |
The visibility of the na of the legend. |
legend.title.color |
The color of the title of the legend. |
legend.title.size |
The size of the title of the legend. |
legend.title.fontface |
The font face of the title of the legend. See |
legend.title.fontfamily |
The font family of the title of the legend. See |
legend.title.alpha |
The alpha transparency of the title of the legend. |
legend.xlab.color |
The color of the xlab of the legend. |
legend.xlab.size |
The size of the xlab of the legend. |
legend.xlab.fontface |
The font face of the xlab of the legend. See |
legend.xlab.fontfamily |
The font family of the xlab of the legend. See |
legend.xlab.alpha |
The alpha transparency of the xlab of the legend. |
legend.ylab.color |
The color of the ylab of the legend. |
legend.ylab.size |
The size of the ylab of the legend. |
legend.ylab.fontface |
The font face of the ylab of the legend. See |
legend.ylab.fontfamily |
The font family of the ylab of the legend. See |
legend.ylab.alpha |
The alpha transparency of the ylab of the legend. |
legend.text.color |
The color of the text of the legend. |
legend.text.size |
The size of the text of the legend. |
legend.text.fontface |
The font face of the text of the legend. See |
legend.text.fontfamily |
The font family of the text of the legend. See |
legend.text.alpha |
The alpha transparency of the text of the legend. |
legend.frame |
The frame of the legend. |
legend.frame.color |
The color of the frame of the legend. |
legend.frame.alpha |
The alpha transparency of the frame of the legend. |
legend.frame.lwd |
The line width of the frame of the legend. See |
legend.frame.r |
The r (radius) of the frame of the legend. |
legend.bg |
The bg of the legend. |
legend.bg.color |
The color of the bg of the legend. |
legend.bg.alpha |
The alpha transparency of the bg of the legend. |
legend.only |
The only of the legend. |
legend.absolute_fontsize |
The absolute fontsize of the legend. So far, only used to calculate legend dimensions |
legend.settings.standard.portrait |
The portrait of the standard of the settings of the legend. |
legend.settings.standard.landscape |
The landscape of the standard of the settings of the legend. |
add_legend.position |
The position of the add_legend. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
chart.show |
The visibility of the chart. |
chart.plot.axis.x |
The x of the axis of the plot of the chart. |
chart.plot.axis.y |
The y of the axis of the plot of the chart. |
chart.position |
The position of the chart. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
chart.width |
The width of the chart. |
chart.height |
The height of the chart. |
chart.reverse |
The reverse of the chart. |
chart.na.show |
The visibility of the na of the chart. |
chart.title.color |
The color of the title of the chart. |
chart.title.size |
The size of the title of the chart. |
chart.title.fontface |
The font face of the title of the chart. See |
chart.title.fontfamily |
The font family of the title of the chart. See |
chart.title.alpha |
The alpha transparency of the title of the chart. |
chart.xlab.color |
The color of the xlab of the chart. |
chart.xlab.size |
The size of the xlab of the chart. |
chart.xlab.fontface |
The font face of the xlab of the chart. See |
chart.xlab.fontfamily |
The font family of the xlab of the chart. See |
chart.xlab.alpha |
The alpha transparency of the xlab of the chart. |
chart.ylab.color |
The color of the ylab of the chart. |
chart.ylab.size |
The size of the ylab of the chart. |
chart.ylab.fontface |
The font face of the ylab of the chart. See |
chart.ylab.fontfamily |
The font family of the ylab of the chart. See |
chart.ylab.alpha |
The alpha transparency of the ylab of the chart. |
chart.text.color |
The color of the text of the chart. |
chart.text.size |
The size of the text of the chart. |
chart.text.fontface |
The font face of the text of the chart. See |
chart.text.fontfamily |
The font family of the text of the chart. See |
chart.text.alpha |
The alpha transparency of the text of the chart. |
chart.frame |
The frame of the chart. |
chart.frame.color |
The color of the frame of the chart. |
chart.frame.alpha |
The alpha transparency of the frame of the chart. |
chart.frame.lwd |
The line width of the frame of the chart. See |
chart.frame.r |
The r (radius) of the frame of the chart. |
chart.bg |
The bg of the chart. |
chart.bg.color |
The color of the bg of the chart. |
chart.bg.alpha |
The alpha transparency of the bg of the chart. |
chart.object.color |
The color of the object of the chart. |
title.size |
The size of the title. |
title.color |
The color of the title. |
title.fontface |
The font face of the title. See |
title.fontfamily |
The font family of the title. See |
title.alpha |
The alpha transparency of the title. |
title.padding |
The padding of the title. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
title.frame |
The frame of the title. |
title.frame.color |
The color of the frame of the title. |
title.frame.alpha |
The alpha transparency of the frame of the title. |
title.frame.lwd |
The line width of the frame of the title. See |
title.frame.r |
The r (radius) of the frame of the title. |
title.position |
The position of the title. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
title.width |
The width of the title. |
credits.size |
The size of the credits. |
credits.color |
The color of the credits. |
credits.fontface |
The font face of the credits. See |
credits.fontfamily |
The font family of the credits. See |
credits.alpha |
The alpha transparency of the credits. |
credits.padding |
The padding of the credits. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
credits.position |
The position of the credits. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
credits.width |
The width of the credits. |
credits.height |
The height of the credits. |
compass.north |
The north of the compass. |
compass.type |
The type of the compass. |
compass.text.size |
The size of the text of the compass. |
compass.size |
The size of the compass. |
compass.show.labels |
The labels of the show of the compass. |
compass.cardinal.directions |
The directions of the cardinal of the compass. |
compass.text.color |
The color of the text of the compass. |
compass.color.dark |
The dark of the color of the compass. |
compass.color.light |
The light of the color of the compass. |
compass.lwd |
The line width of the compass. See |
compass.margins |
The margins of the compass. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
compass.position |
The position of the compass. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset.position |
The position of the inset. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
logo.height |
The height of the logo. |
logo.margins |
The margins of the logo. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
logo.between_margin |
The between_margin of the logo. |
logo.position |
The position of the logo. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset_map.height |
The height of the inset_map. |
inset_map.width |
The width of the inset_map. |
inset_map.margins |
The margins of the inset_map. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inset_map.between_margin |
The between_margin of the inset_map. |
inset_map.position |
The position of the inset_map. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset_map.frame |
The frame of the inset_map. |
inset.height |
The height of the inset. |
inset.width |
The width of the inset. |
inset.margins |
The margins of the inset. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inset.between_margin |
The between_margin of the inset. |
inset.frame |
The frame of the inset. |
inset.bg |
The bg of the inset. |
inset.bg.color |
The color of the bg of the inset. |
inset.bg.alpha |
The alpha transparency of the bg of the inset. |
inset_grob.height |
The height of the inset_grob. |
inset_grob.width |
The width of the inset_grob. |
inset_gg.height |
The height of the inset_gg. |
inset_gg.width |
The width of the inset_gg. |
scalebar.breaks |
See |
scalebar.width |
See |
scalebar.allow_clipping |
See |
scalebar.text.size |
The size of the text of the scalebar. |
scalebar.text.color |
The color of the text of the scalebar. |
scalebar.text.fontface |
The font face of the text of the scalebar. See |
scalebar.text.fontfamily |
The font family of the text of the scalebar. See |
scalebar.color.dark |
The dark of the color of the scalebar. |
scalebar.color.light |
The light of the color of the scalebar. |
scalebar.lwd |
The line width of the scalebar. See |
scalebar.size |
The size of the scalebar. |
scalebar.margins |
The margins of the scalebar. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
scalebar.position |
The position of the scalebar. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
grid.show |
The visibility of the grid. |
grid.labels.pos |
The pos of the labels of the grid. |
grid.x |
The x of the grid. |
grid.y |
The y of the grid. |
grid.n.x |
The x of the n of the grid. |
grid.n.y |
The y of the n of the grid. |
grid.crs |
The coordinate reference system (CRS) of the grid. |
grid.col |
The color of the grid. |
grid.lwd |
The line width of the grid. See |
grid.alpha |
The alpha transparency of the grid. |
grid.labels.show |
The visibility of the labels of the grid. |
grid.labels.size |
The size of the labels of the grid. |
grid.labels.col |
The color of the labels of the grid. |
grid.labels.fontface |
The font face of the labels of the grid. See |
grid.labels.fontfamily |
The font family of the labels of the grid. See |
grid.labels.rot |
The rot of the labels of the grid. |
grid.labels.format |
The format of the labels of the grid. |
grid.labels.cardinal |
The cardinal of the labels of the grid. |
grid.labels.margin.x |
The x of the margin of the labels of the grid. |
grid.labels.margin.y |
The y of the margin of the labels of the grid. |
grid.labels.space.x |
The x of the space of the labels of the grid. |
grid.labels.space.y |
The y of the space of the labels of the grid. |
grid.labels.inside_frame |
The inside_frame of the labels of the grid. |
grid.ticks |
The ticks of the grid. |
grid.lines |
The lines of the grid. |
grid.ndiscr |
The ndiscr of the grid. |
mouse_coordinates.position |
The position of the mouse_coordinates. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
minimap.server |
The server of the minimap. |
minimap.toggle |
The toggle of the minimap. |
minimap.position |
The position of the minimap. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
panel.show |
The visibility of the panel. |
panel.labels |
The labels of the panel. |
panel.label.size |
The size of the label of the panel. |
panel.label.color |
The color of the label of the panel. |
panel.label.fontface |
The font face of the label of the panel. See |
panel.label.fontfamily |
The font family of the label of the panel. See |
panel.label.alpha |
The alpha transparency of the label of the panel. |
panel.label.bg |
The bg of the label of the panel. |
panel.label.bg.color |
The color of the bg of the label of the panel. |
panel.label.bg.alpha |
The alpha transparency of the bg of the label of the panel. |
panel.label.frame |
The frame of the label of the panel. |
panel.label.frame.color |
The color of the frame of the label of the panel. |
panel.label.frame.alpha |
The alpha transparency of the frame of the label of the panel. |
panel.label.frame.lwd |
The line width of the frame of the label of the panel. See |
panel.label.frame.r |
The r (radius) of the frame of the label of the panel. |
panel.label.height |
The height of the label of the panel. |
panel.label.rot |
Rotation angles of the panel labels. Vector of four values that determine the panel label rotation when they are placed left, top, right, and bottom. The default angles are 90, 0, 270 and 0 respectively. Note that the second value is the most common, since labels are by default shown on top (see |
qtm.scalebar |
The scalebar of the qtm. |
qtm.minimap |
The minimap of the qtm. |
qtm.mouse_coordinates |
The mouse_coordinates of the qtm. |
earth_boundary |
The earth boundary |
earth_boundary.color |
The color of the earth_boundary. |
earth_boundary.lwd |
The line width of the earth_boundary. See |
earth_datum |
Earth datum |
space.color |
The color of the space. |
check_and_fix |
Should attempt to fix an invalid shapefile |
basemap.show |
The visibility of the basemap. |
basemap.server |
The server of the basemap. |
basemap.alpha |
The alpha transparency of the basemap. |
basemap.zoom |
The zoom of the basemap. |
tiles.show |
The visibility of the tiles. |
tiles.server |
The server of the tiles. |
tiles.alpha |
The alpha transparency of the tiles. |
tiles.zoom |
The zoom of the tiles. |
attr.color |
The color of the attr. |
crs_extra |
Only used internally (work in progress) |
crs_global |
The used crs for world maps |
crs_basemap |
The crs_basemap of the . |
use_gradient |
Use gradient fill using linearGradient() |
use_browser |
If |
use_WebGL |
use webGL for points, lines, and polygons. For large spatial objects, this is much faster than the standard leaflet layer functions. However, it can not always be used for two reasons. First, the number of visual variables are limited; only fill, size, and color (for lines) are supported. Second, projected CRS's are not supported. Furthermore, it has the drawback that polygon borders are not as sharp. By default only |
control.position |
The position of the control. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
control.bases |
base layers |
control.overlays |
overlay layers |
control.collapse |
Should the box be collapsed or expanded? |
set_bounds |
logical that determines whether maximum bounds are set, or a bounding box. Not applicable in plot mode. In view mode, this is passed on to setMaxBounds() |
set_view |
numeric vector that determines the view.
Either a vector of three: |
set_zoom_limits |
numeric vector of two that set the minimum and maximum zoom levels (see tileOptions()). |
use_circle_markers |
If |
leaflet.options |
options passed on to leafletOptions() |
title |
deprecated See |
main.title |
deprecated See |
main.title.size , main.title.color , main.title.fontface , main.title.fontfamily , main.title.position |
deprecated. Use the |
fontface , fontfamily |
renamed to |
mode |
mode, e.g. |
style |
style, see |
mode.specific |
Should only mode-specific options be returned? |
default.options |
return the default options or the current options? |
Examples
# get all options
opt = tmap_options()
# print as a tree
if (requireNamespace("lobstr")) {
lobstr::tree(opt)
}
# a fancy set of options:
tmap_options(
bg.color = "steelblue",
outer.bg.color = "salmon",
frame.color = "purple3",
frame.lwd = 5,
compass.type = "8star",
legend.bg.color = "gold",
legend.position = tm_pos_in(pos.h = "left", pos.v = "top")
)
if (requireNamespace("lobstr")) {
lobstr::tree(
tmap_options_diff()
)
}
tm_shape(World) +
tm_polygons("footprint")
tmap_options_save("fancy")
# the default style:
tmap_style("white")
tm_shape(World) +
tm_polygons("footprint")
tmap_style("fancy")
tm_shape(World) +
tm_polygons("footprint")
# reset all options
tmap_options_reset()
Group components
Description
Group components
Usage
tm_comp_group(
group_id,
position,
stack,
frame_combine,
equalize,
resize_as_group,
stack_margin,
offset,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
bg,
bg.color,
bg.alpha
)
Arguments
group_id |
id of the component group. Refers to the |
position |
The position specification of the components in this group: an object created with |
stack |
stacking |
frame_combine |
put frame around all components that are drawn on the same location. Whether a frame is drawn is still decided by the |
equalize |
in case |
resize_as_group |
in case a component if rescaled because of the limited space, rescale the other components proportionally? |
stack_margin |
Margin between components |
offset |
Offset margin between frame and the components block |
frame |
Should a frame be drawn? By default |
frame.color |
frame color |
frame.alpha |
frame alpha transparancy |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
bg |
Background color the components block. Is usually set in each component function, but if specified here, it will overwrite them. |
bg.color |
Background color the components block. Is usually set in each component function, but if specified here, it will overwrite them. |
bg.alpha |
Background alpha transparency of the components block. Is usually set in each component function, but if specified here, it will overwrite them. |
Value
Map component: compass
Description
Map component that adds a compass
Usage
tm_compass(
north,
type,
text.size,
size,
show.labels,
cardinal.directions,
text.color,
color.dark,
color.light,
lwd,
position,
group_id,
bg,
bg.color,
bg.alpha,
stack,
just,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
margins,
z,
...
)
Arguments
north |
north |
type |
compass type, one of: |
text.size |
text.size |
size |
size |
show.labels |
show.labels |
cardinal.directions |
cardinal.directions |
text.color |
text.color |
color.dark |
color.dark |
color.light |
color.light |
lwd |
lwd |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
bg |
Show background? |
bg.color |
Background color |
bg.alpha |
Background transparency |
stack |
stack with other map components, either |
just |
just |
frame |
frame should a frame be drawn? |
frame.color |
frame color |
frame.alpha |
frame alpha transparancy |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
margins |
margins |
z |
z index, e.g. the place of the component relative to the other componets |
... |
to catch deprecated arguments (alpha) |
See Also
tmap function to define a constant visual value
Description
tmap function to define a constant visual value
Usage
tm_const()
Map component: (credits) text
Description
Map component that adds a text, typically used as credits. This function is the same as tm_title()
but with different default values.
Usage
tm_credits(
text,
size,
color,
padding,
fontface,
fontfamily,
alpha,
stack,
just,
frame,
frame.lwd,
frame.r,
bg,
bg.color,
bg.alpha,
position,
group_id,
width,
height,
z,
...
)
Arguments
text |
text |
size |
font size |
color |
font color |
padding |
padding |
fontface |
font face, bold, italic |
fontfamily |
font family |
alpha |
alpha transparency of the text |
stack |
stack with other map components, either |
just |
just |
frame |
frame should a frame be drawn? |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
bg |
Show background? |
bg.color |
Background color |
bg.alpha |
Background transparency |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
width , height |
width and height of the component. |
z |
z index, e.g. the place of the component relative to the other componets |
... |
to catch deprecated arguments |
See Also
Set the map projection (CRS)
Description
This function sets the map projection. It can also be set via tm_shape()
, but tm_crs
is generally recommended for most cases. It can also be determined automatically (see details); however, this is still work-in-progress.
Usage
tm_crs(crs = NA, property = NA)
Arguments
crs |
Map projection (CRS). Can be set to an |
property |
Which property should the projection have? One of: |
Details
The map projection (crs
) determines in which coordinate system the spatial object is processed and plotted.
See vignette about CRS. The crs
can be specified in two places: 1) tm_shape()
and tm_crs()
.
In both cases, the map is plotted into the specified crs
. The difference is that in the first option, the crs
is also taken into account in spatial transformation functions, such as the calculation of centroids and cartograms. In the second option, the crs
is only used in the plotting phase.
The automatic crs recommendation (which is still work-in-progress) is the following:
Property | Recommendation |
global (for world maps) | A pseudocylindrical projection tmap option crs_global , by default "eqearth (Equal Earth). See https://r-tmap.github.io/tmap/articles/41_advanced_crs.html for more options |
area (equal area) | Lambert Azimuthal Equal Area (laea ) |
distance (equidistant) | Azimuthal Equidistant (aeqd ) |
shape (conformal) | Stereographic (stere ) |
For further info about the available "generic" projects see: for utm: https://proj.org/en/9.4/operations/projections/utm.html for laea: https://proj.org/en/9.4/operations/projections/laea.html for aeqd: https://proj.org/en/9.4/operations/projections/aeqd.html for pconic: https://proj.org/en/9.4/operations/projections/pconic.html for eqdc: https://proj.org/en/9.4/operations/projections/eqdc.html
Note
Plans are to migrate the functionality regarding generic crs and automatic crs recommendation to a separate package.
See Also
Examples
SA = World[World$continent == "South America", ]
# latlon coordinates (WGS84)
tm_shape(SA) +
tm_polygons() +
tm_graticules() +
tm_crs(4326)
tm_list = lapply(c("global", "area", "distance", "shape"), FUN = function(property) {
tm_shape(SA) +
tm_polygons() +
tm_graticules() +
tm_crs(property = property) +
tm_title(property)
})
tmap_arrange(tm_list, nrow = 1)
Specify facets
Description
-
tm_facets_wrap()
specify facets for one grouping variable (so one faceting dimension) -
tm_facets_(hv)stack()
stacks the facets either horizontally or vertically (one grouping variable). -
tm_facets_grid()
specify facets for two grouping variables in a grid of rows and columns. -
tm_facets_pagewise()
same as wrap, but the facets are drawn on different plots (pages). Replaces thealong
argument from version 3. -
tm_facets_flip()
can be used to flip facets. -
tm_facets()
is the core function, but it is recommended to use the other functions.
Usage
tm_facets(
by = NULL,
rows = NULL,
columns = NULL,
pages = NULL,
as.layers = FALSE,
nrow = NA,
ncol = NA,
byrow = TRUE,
orientation = NA,
free.coords = NA,
drop.units = TRUE,
drop.empty.facets = TRUE,
drop.NA.facets = FALSE,
sync = TRUE,
na.text = NA,
scale.factor = 2,
type = NA,
free.scales = NULL,
...
)
tm_facets_grid(rows = NULL, columns = NULL, pages = NULL, ...)
tm_facets_wrap(by = "VARS__", nrow = NA, ncol = NA, byrow = TRUE, ...)
tm_facets_pagewise(by = "VARS__", byrow = TRUE, ...)
tm_facets_stack(by = "VARS__", orientation = NA, ...)
tm_facets_hstack(by = "VARS__", ...)
tm_facets_vstack(by = "VARS__", ...)
tm_facets_flip(...)
Arguments
by |
Group by variable (only for a facet wrap or facet stack) |
rows |
Variable that specifies the rows (only for a facet grid) |
columns |
Variable that specifies the columns (only for a facet grid) |
pages |
Variable that specifies the pages (only for a facet grid) |
as.layers |
show facets as layers? |
nrow |
Number of rows |
ncol |
Number of columns |
byrow |
Should facets be wrapped by row? |
orientation |
For facet stack: horizontal or vertical? |
free.coords |
Logical. If the |
drop.units |
Logical. If the |
drop.empty.facets |
Logical. If the |
drop.NA.facets |
Logical. If the |
sync |
Logical. Should the navigation in view mode (zooming and panning)
be synchronized? By default |
na.text |
Text used for facets of missing values. In v3, it was |
scale.factor |
Number that determines how the elements (e.g. font sizes,
symbol sizes, line widths) of the small multiples are scaled in relation to
the scaling factor of the shapes. The elements are scaled to the |
type |
|
free.scales |
deprecated. Please use the |
... |
passed on to |
See Also
Examples
## Not run:
tm_shape(NLD_dist) +
tm_polygons("edu_appl_sci",
fill.scale = tm_scale_intervals(values = "pu_gn", style = "kmeans", n = 7)) +
tm_facets(by = "province") +
tm_shape(NLD_muni) +
tm_borders(lwd = 3) +
tm_facets(by = "province") +
tm_title("Population with a univeristy degree (incl appl. sciences), percentages")
tm_shape(World) +
tm_polygons(c("gender", "press"),
fill.scale = list(tm_scale_intervals(values = "bu_br_div", midpoint = 0.5),
tm_scale_intervals(values = "pu_gn_div", midpoint = 50)),
fill.legend = tm_legend("")) +
tm_layout(panel.labels = c("Gender Inequality Index (GII)", "World Press Freedom Index"))
## End(Not run)
Coordinate grid / graticule lines
Description
Draws horizontal and vertical lines according to a coordinate reference system (CRS). tm_grid()
uses the CRS of the (master) shape object, and tm_graticules()
uses latitude and longitude coordinates (EPSG 4326). It creates a tmap-element
that draws coordinate grid lines. It serves as a
layer that can be drawn anywhere between other layers.
Usage
tm_graticules(
x = NA,
y = NA,
n.x = NA,
n.y = NA,
crs = 4326,
labels.format = list(suffix = intToUtf8(176)),
labels.cardinal = TRUE,
...
)
tm_grid(
x = NA,
y = NA,
n.x = NA,
n.y = NA,
crs = NA,
col = NA,
lwd = 1,
alpha = NA,
labels.show = TRUE,
labels.pos = c("left", "bottom"),
labels.size = 0.6,
labels.col = NA,
labels.rot = c(0, 0),
labels.format = list(big.mark = ","),
labels.cardinal = FALSE,
labels.margin.x = 0,
labels.margin.y = 0,
labels.space.x = NA,
labels.space.y = NA,
labels.inside_frame = FALSE,
ticks = labels.show & !labels.inside_frame,
lines = TRUE,
ndiscr = 100,
zindex = NA,
group = NA,
group.control = "none",
...
)
Arguments
x |
X coordinates for vertical grid lines. If |
y |
Y coordinates for horizontal grid lines. If |
n.x |
Preferred number of grid lines for the x axis. For the labels,
a |
n.y |
Preferred number of grid lines for the y axis. For the labels, a
|
crs |
Projection character. If specified, the grid lines are projected accordingly. Many world maps are projected, but still have latitude longitude (EPSG 4326) grid lines. |
labels.format |
List of formatting options for the grid labels. Parameters are:
|
labels.cardinal |
Add the four cardinal directions (N, E, S, W) to the labels, instead of using negative coordinates for west and south (so it assumes that the coordinates are positive in the north-east direction). |
... |
Used to catch deprecated arguments from tmap v3. |
col |
Color of the grid lines. |
lwd |
Line width of the grid lines |
alpha |
Alpha transparency of the grid lines. Number between 0 and 1.
By default, the alpha transparency of |
labels.show |
Show tick labels. Either one value for both |
labels.pos |
position of the labels. Vector of two: the horizontal ("left" or "right") and the vertical ("top" or "bottom") position. |
labels.size |
Font size of the tick labels |
labels.col |
Font color of the tick labels |
labels.rot |
Rotation angles of the labels. Vector of two values: the
first is the rotation angle (in degrees) of the tick labels on the x axis
and the second is the rotation angle of the tick labels on the y axis.
Only |
labels.margin.x |
Margin between tick labels of x axis and the frame.
Note that when |
labels.margin.y |
Margin between tick labels of y axis and the frame.
Note that when |
labels.space.x |
Space that is used for the labels and ticks for the x-axis
when |
labels.space.y |
Space that is used for the labels and ticks for the y-axis
when |
labels.inside_frame |
Show labels inside the frame? By default |
ticks |
If |
lines |
If |
ndiscr |
Number of points to discretize a parallel or meridian (only applicable for curved grid lines) |
zindex |
zindex of the pane in view mode. By default, it is set to the
layer number plus 400. By default, the tmap layers will therefore be placed
in the custom panes |
group |
Name of the group to which this layer belongs.
This is only relevant in view mode, where layer groups can be
switched (see |
group.control |
In view mode, the group control determines how layer groups
can be switched on and off. Options: |
Examples
## Not run:
current.mode <- tmap_mode("plot")
tm_shape(NLD_muni) +
tm_polygons() +
tm_grid()
tm_shape(NLD_muni) +
tm_polygons() +
tm_grid(crs = 4326)
tm_shape(NLD_muni) +
tm_polygons() +
tm_grid(crs = 3035, labels.inside.frame = TRUE)
tm_shape(World) +
tm_polygons() +
tm_facets(by = "continent") +
tm_grid(labels.inside.frame = TRUE)
tm_shape(NLD_muni) +
tm_polygons() +
tm_graticules()
tm_shape(NLD_muni) +
tm_polygons() +
tm_graticules(labels.pos = c("right", "top"))
data(NLD_muni, World)
tmap_arrange(
qtm(NLD_muni) + tm_grid(),
qtm(NLD_muni) + tm_graticules()
)
qtm(World, shape.crs = "+proj=robin", style = "natural") +
tm_graticules(ticks = FALSE) +
tm_layout(frame=FALSE)
tmap_mode(current.mode)
## End(Not run)
Layer group control
Description
Controls the layer groups in interactive maps (view mode): the layer control box (radio buttons or check boxes) and at which zoom levels the layers are displayed at.
Usage
tm_group(name, control = NA, zoom_levels = NA)
Arguments
name |
group name that corresponds with the group name specified in the layer functions (e.g. |
control |
The group control determines how
layer groups can be switched on and off. Options: |
zoom_levels |
The zoom levels at which the group is displays at. When specified |
See Also
Map component: inset maps and other objects
Description
Map component that adds an inset object, e.g. a mini map
Usage
tm_inset(
x = NULL,
height,
width,
margins,
between_margin,
position,
group_id,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
bg,
bg.color,
bg.alpha,
z
)
Arguments
x |
object to draw. Can be: bounding box, tmap object, ggplot2 object, grob object, image file name. |
height |
height of the component in number of text line heights. |
width |
width of the component in number of text line heights. |
margins |
margins |
between_margin |
Margin between |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
frame |
frame should a frame be drawn? |
frame.color |
frame color |
frame.alpha |
frame alpha transparancy |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
bg |
Show background? |
bg.color |
Background color |
bg.alpha |
Background transparency |
z |
z index, e.g. the place of the component relative to the other componets |
Examples
## map
bb = tmaptools::bb(NLD_prov[NLD_prov$name == "Utrecht",], ext = 1.05)
bb_Randstad =
sf::st_bbox(c(xmin = 120000, xmax = 150000, ymin = 460000, ymax = 500000), crs = 28992)
tm_shape(NLD_dist) +
tm_polygons(
fill = "dwelling_value",
fill.scale = tm_scale_continuous_pseudo_log(values = "-cols4all.pu_gn_div"),
col = NULL) +
tm_shape(NLD_muni) +
tm_borders(col = "black", lwd = 0.5) +
tm_shape(NLD_prov) +
tm_borders(col = "black", lwd = 1.5) +
tm_inset(bb_Randstad, height = 12, width = 12, position = c("left", "top")) +
tm_compass(position = c("left", "top"), )
## ggplot2
if (requireNamespace("ggplot2")) {
library(ggplot2)
p = ggplot(World, aes(x = gender, y = press, colour = continent)) +
geom_point() +
theme_bw()
tm_shape(World) +
tm_polygons(
fill = "gender",
fill.scale = tm_scale(values = "-cols4all.pu_gn_div")) +
tm_inset(p, height = 15, width = 20, position = tm_pos_in("left", "bottom"))
}
Map layer: iso (contour)
Description
Map layer that draws iso (contour) lines. Stack of tm_lines()
and tm_labels_highlighted.
Usage
tm_iso(
col = tm_const(),
text = tm_vars(x = 1),
...,
options_lines = opt_tm_lines(),
options_labels = opt_tm_labels()
)
Arguments
col |
Visual variable that determines the color. See details. |
text |
Visual variable that determines the text. See details. |
... |
passed on to |
options_lines |
The options for |
options_labels |
The options for |
Legend
Description
Legend specification
Usage
tm_legend(
title,
show,
orientation,
design,
reverse,
na.show,
position,
group_id,
width,
height,
z,
title.color,
title.size,
title.fontface,
title.fontfamily,
title.alpha,
title.padding,
title.align,
text.color,
text.size,
text.fontface,
text.fontfamily,
text.alpha,
format,
frame,
frame.lwd,
frame.r,
bg,
bg.color,
bg.alpha,
absolute_fontsize,
item.height,
item.width,
item.space,
item.na.height,
item.na.width,
item.na.space,
item.shape,
ticks,
ticks.disable.na,
ticks.col,
ticks.lwd,
margins,
item_text.margin,
...
)
tm_legend_hide()
tm_legend_combine(variable)
tm_legend_bivariate(
xlab,
ylab,
xlab.color,
xlab.size,
xlab.fontface,
xlab.fontfamily,
xlab.alpha,
xlab.padding,
xlab.align,
ylab.color,
ylab.size,
ylab.fontface,
ylab.fontfamily,
ylab.alpha,
ylab.padding,
ylab.align,
...
)
Arguments
title |
Legend title |
show |
Show legend? |
orientation |
Orientation of the legend: |
design |
Legend design |
reverse |
Should the legend be reversed? |
na.show |
Show |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
width |
Width of the legend. Units are 'text line heights'. In case a negative number is specified, the units are (approximate) pixels. The relation between these two is configured via the option |
height |
Height of the legend. Units are 'text line heights'. In case a negative number is specified, the units are (approximate) pixels. The relation between these two is configured via the option |
z |
z index, e.g. the place of the component relative to the other componets |
title.color |
The color of the title of the legend. |
title.size |
The size of the title of the legend. |
title.fontface |
The font face of the title of the legend. See |
title.fontfamily |
The font family of the title of the legend. See |
title.alpha |
The alpha transparency of the title of the legend. |
title.padding |
The padding of the title of the legend. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
title.align |
The align of the title of the legend. |
text.color |
The color of the text of the legend. |
text.size |
The size of the text of the legend. |
text.fontface |
The font face of the text of the legend. See |
text.fontfamily |
The font family of the text of the legend. See |
text.alpha |
The alpha transparency of the text of the legend. |
format |
Not used anymore: use the format argument of the |
frame |
frame should a frame be drawn? |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
bg |
Show background? |
bg.color |
The color of the bg of the legend. |
bg.alpha |
The alpha transparency of the bg of the legend. |
absolute_fontsize |
The absolute fontsize of the legend. So far, only used to calculate legend dimensions |
item.height |
The height of the item of the legend. |
item.width |
The width of the item of the legend. |
item.space |
The space of the item of the legend. In terms of number of text line heights. |
item.na.height |
The height of the na item of the legend. |
item.na.width |
The width of the na item of the legend. |
item.na.space |
The space of the na item of the legend. In terms of number of text line heights. |
item.shape |
The shape of the item of the legend. |
ticks |
List of vectors of size 2 that determines the horizontal tick mark lines (for portrait legends). The values are the y-values of begin and endpoint of each tick mark. |
ticks.disable.na |
Remove ticks for |
ticks.col |
The color of the ticks of the legend. |
ticks.lwd |
The line width of the ticks of the legend. See |
margins |
The margins of the legend. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
item_text.margin |
The margin of the space between item and text of the legend. |
... |
visual values, e.g. |
variable |
visual (or transformation) variable to combine the legend with: e.g. |
xlab |
label for the x dimension (rows) |
ylab |
label for the y dimension (columns) |
xlab.color |
The color of the xlab of the legend. |
xlab.size |
The size of the xlab of the legend. |
xlab.fontface |
The font face of the xlab of the legend. See |
xlab.fontfamily |
The font family of the xlab of the legend. See |
xlab.alpha |
The alpha transparency of the xlab of the legend. |
xlab.padding |
The padding of the xlab of the legend. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
xlab.align |
The align of the xlab of the legend. |
ylab.color |
The color of the ylab of the legend. |
ylab.size |
The size of the ylab of the legend. |
ylab.fontface |
The font face of the ylab of the legend. See |
ylab.fontfamily |
The font family of the ylab of the legend. See |
ylab.alpha |
The alpha transparency of the ylab of the legend. |
ylab.padding |
The padding of the ylab of the legend. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
ylab.align |
The align of the ylab of the legend. |
Value
A tm_legend component
See Also
Examples
# Example using different settings from tm_legend()
tm_shape(World) +
tm_polygons(
fill = "HPI",
fill.legend = tm_legend(
title = "Home Price Index",
design = "standard",
title.color = "orange",
bg.color = "purple",
show = TRUE
),
id = "name",
# Format the labels using dollar sign
fill.scale = tm_scale_intervals(
label.format = function(x) format(x, big.mark = " ")),
)
Map layer: lines
Description
Map layer that draws lines. Supported visual variables are: col
(the color), lwd
(line width), lty
(line type), and col_alpha
(color alpha transparency).
Usage
tm_lines(
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
lwd = tm_const(),
lwd.scale = tm_scale(),
lwd.legend = tm_legend(),
lwd.chart = tm_chart_none(),
lwd.free = NA,
lty = tm_const(),
lty.scale = tm_scale(),
lty.legend = tm_legend(),
lty.chart = tm_chart_none(),
lty.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
linejoin = "round",
lineend = "round",
plot.order = tm_plot_order("lwd", reverse = TRUE, na.order = "bottom"),
zindex = NA,
group = NA,
group.control = "check",
popup.vars = NA,
popup.format = list(),
hover = NA,
id = "",
options = opt_tm_lines(),
...
)
opt_tm_lines(lines.only = "ifany")
Arguments
col , col.scale , col.legend , col.chart , col.free |
Visual variable that determines the color. See details. |
lwd , lwd.scale , lwd.legend , lwd.chart , lwd.free |
Visual variable that determines the line width. See details. |
lty , lty.scale , lty.legend , lty.chart , lty.free |
Visual variable that determines the line type. See details. |
col_alpha , col_alpha.scale , col_alpha.legend , col_alpha.chart , col_alpha.free |
Visual variable that determines the color transparency. See details. |
linejoin , lineend |
line join and line end. See gpar() for details. |
plot.order |
Specification in which order the spatial features are drawn. See |
zindex |
Map layers are drawn on top of each other. The |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how layer groups
can be switched on and off. Options: |
popup.vars |
names of data variables that are shown in the popups
in |
popup.format |
list of formatting options for the popup values.
See the argument |
hover |
name of the data variable that specifies the hover labels (view mode only). Set to |
id |
name of the data variable that specifies the indices of the spatial
features. Only used for |
options |
options passed on to the corresponding |
... |
to catch deprecated arguments from version < 4.0 |
lines.only |
should only line geometries of the shape object (defined in |
Details
The visual variable arguments (e.g. col
) can be specified with either a data
variable name (e.g., a spatial vector attribute or a raster layer of the object
specified in tm_shape()
), or with a visual value (for col
, a color is expected).
See vignette about visual variables.
Multiple values can be specified: in that case facets are created.
These facets can be combined with other faceting data variables, specified with tm_facets()
.
See vignette about facets.
The
*.scale
arguments determine the used scale to map the data values to visual variable values. These can be specified with one of the availabletm_scale_*()
functions. The default is specified by the tmap option (tm_options()
)scales.var
. See vignette about scales.The
*.legend
arguments determine the used legend, specified withtm_legend()
. The default legend and its settings are determined by the tmap options (tm_options()
)legend.
. See vignette about legends.The
*.chart
arguments specify additional charts, specified withtm_chart_
, e.g.tm_chart_histogram()
. See vignette about charts.The
*.free
arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (seetm_facets()
). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid (tm_facets_grid()
). For instance,col.free = c(TRUE, FALSE, FALSE)
means that for the visual variablecol
, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks (tm_facets_wrap()
andtm_facets_stack()
) there is only one facet dimension, so the*.free
argument requires only one logical value.
See Also
Examples
tm_shape(World_rivers) +
tm_lines(lwd = "strokelwd",
lwd.scale = tm_scale_asis(values.scale = 0.2, value.neutral = 2),
col = "scalerank",
col.scale = tm_scale_categorical(values = "seaborn.dark"))
tm_shape(World) +
tm_lines(col = "continent",
col.scale = tm_scale_categorical(values = "seaborn.dark"),
lty = "continent",
lwd = 1.5,
lty.legend = tm_legend_combine("col"))
Map component: logo
Description
Map component that adds a logo.
Usage
tm_logo(
file,
height,
margins,
between_margin,
stack,
position,
group_id,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
z
)
Arguments
file |
either a filename or url of a png image. If multiple files/urls are provided with a character vector, the logos are placed near each other.
To specify logos for small multiples use a list of character values/vectors. In order to stack logos vertically, multiple |
height |
height of the logo in number of text line heights. The width is scaled based the height and the aspect ratio of the logo. If multiple logos are specified by a vector or list, the heights can be specified accordingly. |
margins |
margins |
between_margin |
Margin between |
stack |
stack with other map components, either |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
frame |
frame should a frame be drawn? |
frame.color |
frame color |
frame.alpha |
frame alpha transparancy |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
z |
z index, e.g. the place of the component relative to the other componets |
See Also
Examples
data(World)
tm_shape(World) +
tm_polygons("HPI", fill.scale = tm_scale_intervals(values = "brewer.rd_yl_gn")) +
tm_logo(c("https://www.r-project.org/logo/Rlogo.png",
system.file("help", "figures", "logo.png", package = "tmap"))) +
tm_logo("http://blog.kulikulifoods.com/wp-content/uploads/2014/10/logo.png",
height=5, position = c("left", "top"))
Map component: minimap
Description
Map component that adds a minimap in view mode.
Usage
tm_minimap(server, toggle, stack, position, group_id, z, ...)
Arguments
server |
name of the provider or an URL (see |
toggle |
should the minimap have a button to minimise it? By default |
stack |
stack with other map components, either |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
z |
z index, e.g. the place of the component relative to the other componets |
... |
Arguments passed on to
|
See Also
Map component: mouse coordinates
Description
Map component that adds mouse coordinates
Usage
tm_mouse_coordinates(stack, position, group_id, z)
Arguments
stack |
stack with other map components, either |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
z |
z index, e.g. the place of the component relative to the other componets |
See Also
tmap options
Description
tmap options
Usage
tm_options(
crs,
facet.max,
facet.flip,
free.scales,
raster.max_cells,
raster.warp,
show.messages,
show.warnings,
output.format,
output.size,
output.dpi,
animation.dpi,
value.const,
value.na,
value.null,
value.blank,
values.var,
values.range,
value.neutral,
values.scale,
scales.var,
scale.misc.args,
continuous.nclass_per_legend_break,
continuous.nclasses,
label.format,
label.na,
scale,
asp,
bg,
bg.color,
outer.bg,
outer.bg.color,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
frame.double_line,
outer.margins,
inner.margins,
inner.margins.extra,
meta.margins,
meta.auto_margins,
between_margin,
panel.margin,
grid.mark.height,
xylab.height,
coords.height,
xlab.show,
xlab.text,
xlab.size,
xlab.color,
xlab.rotation,
xlab.space,
xlab.fontface,
xlab.fontfamily,
xlab.alpha,
xlab.side,
ylab.show,
ylab.text,
ylab.size,
ylab.color,
ylab.rotation,
ylab.space,
ylab.fontface,
ylab.fontfamily,
ylab.alpha,
ylab.side,
panel.type,
panel.wrap.pos,
panel.xtab.pos,
unit,
color.sepia_intensity,
color.saturation,
color_vision_deficiency_sim,
text.fontface,
text.fontfamily,
text.alpha,
component.position,
component.offset,
component.stack_margin,
component.autoscale,
component.resize_as_group,
component.frame_combine,
component.stack,
legend.stack,
chart.stack,
component.equalize,
component.frame,
component.frame.color,
component.frame.alpha,
component.frame.lwd,
component.frame.r,
component.bg,
component.bg.color,
component.bg.alpha,
legend.show,
legend.design,
legend.orientation,
legend.position,
legend.width,
legend.height,
legend.reverse,
legend.na.show,
legend.title.color,
legend.title.size,
legend.title.fontface,
legend.title.fontfamily,
legend.title.alpha,
legend.xlab.color,
legend.xlab.size,
legend.xlab.fontface,
legend.xlab.fontfamily,
legend.xlab.alpha,
legend.ylab.color,
legend.ylab.size,
legend.ylab.fontface,
legend.ylab.fontfamily,
legend.ylab.alpha,
legend.text.color,
legend.text.size,
legend.text.fontface,
legend.text.fontfamily,
legend.text.alpha,
legend.frame,
legend.frame.color,
legend.frame.alpha,
legend.frame.lwd,
legend.frame.r,
legend.bg,
legend.bg.color,
legend.bg.alpha,
legend.only,
legend.absolute_fontsize,
legend.settings.standard.portrait,
legend.settings.standard.landscape,
add_legend.position,
chart.show,
chart.plot.axis.x,
chart.plot.axis.y,
chart.position,
chart.width,
chart.height,
chart.reverse,
chart.na.show,
chart.title.color,
chart.title.size,
chart.title.fontface,
chart.title.fontfamily,
chart.title.alpha,
chart.xlab.color,
chart.xlab.size,
chart.xlab.fontface,
chart.xlab.fontfamily,
chart.xlab.alpha,
chart.ylab.color,
chart.ylab.size,
chart.ylab.fontface,
chart.ylab.fontfamily,
chart.ylab.alpha,
chart.text.color,
chart.text.size,
chart.text.fontface,
chart.text.fontfamily,
chart.text.alpha,
chart.frame,
chart.frame.color,
chart.frame.alpha,
chart.frame.lwd,
chart.frame.r,
chart.bg,
chart.bg.color,
chart.bg.alpha,
chart.object.color,
title.size,
title.color,
title.fontface,
title.fontfamily,
title.alpha,
title.padding,
title.frame,
title.frame.color,
title.frame.alpha,
title.frame.lwd,
title.frame.r,
title.position,
title.width,
credits.size,
credits.color,
credits.fontface,
credits.fontfamily,
credits.alpha,
credits.padding,
credits.position,
credits.width,
credits.height,
compass.north,
compass.type,
compass.text.size,
compass.size,
compass.show.labels,
compass.cardinal.directions,
compass.text.color,
compass.color.dark,
compass.color.light,
compass.lwd,
compass.margins,
compass.position,
inset.position,
logo.height,
logo.margins,
logo.between_margin,
logo.position,
inset_map.height,
inset_map.width,
inset_map.margins,
inset_map.between_margin,
inset_map.position,
inset_map.frame,
inset.height,
inset.width,
inset.margins,
inset.between_margin,
inset.frame,
inset.bg,
inset.bg.color,
inset.bg.alpha,
inset_grob.height,
inset_grob.width,
inset_gg.height,
inset_gg.width,
scalebar.breaks,
scalebar.width,
scalebar.allow_clipping,
scalebar.text.size,
scalebar.text.color,
scalebar.text.fontface,
scalebar.text.fontfamily,
scalebar.color.dark,
scalebar.color.light,
scalebar.lwd,
scalebar.size,
scalebar.margins,
scalebar.position,
grid.show,
grid.labels.pos,
grid.x,
grid.y,
grid.n.x,
grid.n.y,
grid.crs,
grid.col,
grid.lwd,
grid.alpha,
grid.labels.show,
grid.labels.size,
grid.labels.col,
grid.labels.fontface,
grid.labels.fontfamily,
grid.labels.rot,
grid.labels.format,
grid.labels.cardinal,
grid.labels.margin.x,
grid.labels.margin.y,
grid.labels.space.x,
grid.labels.space.y,
grid.labels.inside_frame,
grid.ticks,
grid.lines,
grid.ndiscr,
mouse_coordinates.position,
minimap.server,
minimap.toggle,
minimap.position,
panel.show,
panel.labels,
panel.label.size,
panel.label.color,
panel.label.fontface,
panel.label.fontfamily,
panel.label.alpha,
panel.label.bg,
panel.label.bg.color,
panel.label.bg.alpha,
panel.label.frame,
panel.label.frame.color,
panel.label.frame.alpha,
panel.label.frame.lwd,
panel.label.frame.r,
panel.label.height,
panel.label.rot,
qtm.scalebar,
qtm.minimap,
qtm.mouse_coordinates,
earth_boundary,
earth_boundary.color,
earth_boundary.lwd,
earth_datum,
space.color,
check_and_fix,
basemap.show,
basemap.server,
basemap.alpha,
basemap.zoom,
tiles.show,
tiles.server,
tiles.alpha,
tiles.zoom,
attr.color,
crs_extra,
crs_global,
crs_basemap,
title = NULL,
main.title = NULL,
main.title.size = NULL,
main.title.color = NULL,
main.title.fontface = NULL,
main.title.fontfamily = NULL,
main.title.position = NULL,
fontface = NULL,
fontfamily = NULL,
style,
...
)
Arguments
crs |
Map crs (see |
facet.max |
Maximum number of facets |
facet.flip |
Should facets be flipped (in case of facet wrap)? This can also be set via |
free.scales |
For backward compatibility: if this value is set, it will be used to impute the free arguments in the layer functions |
raster.max_cells |
Maximum number of raster grid cells. Can be mode specific |
raster.warp |
Should rasters be warped or transformed in case a different projection (crs) is used? Warping creates a new regular raster in the target crs, whereas transforming creates a (usually non-regular) raster in the target crs. The former is lossy, but much faster and is therefore the default. When a different projection (crs) is used, a (usually) regular raster will be |
show.messages |
Show messages? |
show.warnings |
Show warnings? |
output.format |
Output format |
output.size |
Output size |
output.dpi |
Output dpi |
animation.dpi |
Output dpi for animations |
value.const |
Default visual value constants e.g. the default fill color for |
value.na |
Default visual values that are used to visualize NA data values. A list is required with per visual variable a value. |
value.null |
Default visual values that are used to visualize null (out-of-scope) data values. A list is required with per visual variable a value. |
value.blank |
Default visual values that correspond to blank. For color these are |
values.var |
Default values when a data variable to mapped to a visual variable, e.g. a color palette. A list is required with per visual variable a value. |
values.range |
Default range for values. See |
value.neutral |
Default values for when a data variable to mapped to a visual variable, e.g. a color palette. A list is required with per visual variable a value. |
values.scale |
Default scales (as in object sizes) for values. See |
scales.var |
Default scale functions per visual variable and type of data variable. A list is required with per visual variable per data type. |
scale.misc.args |
Default values of scale function-specific arguments. A list is required with per scale function and optional per visual variable. |
continuous.nclass_per_legend_break |
The number of continuous legend breaks within one 'unit' (label). The default value is 50. |
continuous.nclasses |
the number of classes of a continuous scale. Should be odd. The default value is 101. |
label.format |
Format for the labels (was |
label.na |
Default label for missing values. |
scale |
Overall scale of the map |
asp |
Aspect ratio of each map. When |
bg |
Draw map background? |
bg.color |
Background color of the map. |
outer.bg |
Draw map background (outside the frame)? |
outer.bg.color |
Background color of map outside the frame. |
frame |
Draw map frame? |
frame.color |
The color of the frame. |
frame.alpha |
The alpha transparency of the frame. |
frame.lwd |
The line width of the frame. See |
frame.r |
The r (radius) of the frame. |
frame.double_line |
The double line of the frame. |
outer.margins |
The margins of the outer space (outside the frame. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inner.margins |
The margins of the inner space (inside the frame). A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inner.margins.extra |
The extra arguments of the margins of the inner space (inside the frame). A list of arguments. |
meta.margins |
The margins of the meta. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
meta.auto_margins |
The auto_margins of the meta. |
between_margin |
Margin between the map. |
panel.margin |
The margin of the panel. |
grid.mark.height |
The height of the mark of the grid. |
xylab.height |
The height of the xylab. |
coords.height |
The height of the coords. |
xlab.show |
The visibility of the xlab. |
xlab.text |
The text of the xlab. |
xlab.size |
The size of the xlab. |
xlab.color |
The color of the xlab. |
xlab.rotation |
The rotation of the xlab. |
xlab.space |
The space of the xlab. In terms of number of text line heights. |
xlab.fontface |
The font face of the xlab. See |
xlab.fontfamily |
The font family of the xlab. See |
xlab.alpha |
The alpha transparency of the xlab. |
xlab.side |
The side of the xlab. |
ylab.show |
The visibility of the ylab. |
ylab.text |
The text of the ylab. |
ylab.size |
The size of the ylab. |
ylab.color |
The color of the ylab. |
ylab.rotation |
The rotation of the ylab. |
ylab.space |
The space of the ylab. In terms of number of text line heights. |
ylab.fontface |
The font face of the ylab. See |
ylab.fontfamily |
The font family of the ylab. See |
ylab.alpha |
The alpha transparency of the ylab. |
ylab.side |
The side of the ylab. |
panel.type |
The type of the panel. |
panel.wrap.pos |
The panel positions for wrapped facets created with |
panel.xtab.pos |
The panel positions for grid facets created with |
unit |
Unit of the coordinate |
color.sepia_intensity |
The sepia_intensity of the color. |
color.saturation |
The saturation of the color. |
color_vision_deficiency_sim |
'Color vision deficiency simulation |
text.fontface |
The font face of the text. See |
text.fontfamily |
The font family of the text. See |
text.alpha |
The alpha transparency of the text. |
component.position |
The position of the component. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
component.offset |
The offset of the component. |
component.stack_margin |
The stack_margin of the component. |
component.autoscale |
The autoscale of the component. |
component.resize_as_group |
The resize_as_group of the component. |
component.frame_combine |
The frame_combine of the component. |
component.stack |
The stack of the component. |
legend.stack |
The stack of the legend. |
chart.stack |
The stack of the chart. |
component.equalize |
The equalize of the component. |
component.frame |
The frame of the component. |
component.frame.color |
The color of the frame of the component. |
component.frame.alpha |
The alpha transparency of the frame of the component. |
component.frame.lwd |
The line width of the frame of the component. See |
component.frame.r |
The r (radius) of the frame of the component. |
component.bg |
The bg of the component. |
component.bg.color |
The color of the bg of the component. |
component.bg.alpha |
The alpha transparency of the bg of the component. |
legend.show |
The visibility of the legend. |
legend.design |
The design of the legend. |
legend.orientation |
The orientation of the legend. |
legend.position |
The position of the legend. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
legend.width |
The width of the legend. |
legend.height |
The height of the legend. |
legend.reverse |
The reverse of the legend. |
legend.na.show |
The visibility of the na of the legend. |
legend.title.color |
The color of the title of the legend. |
legend.title.size |
The size of the title of the legend. |
legend.title.fontface |
The font face of the title of the legend. See |
legend.title.fontfamily |
The font family of the title of the legend. See |
legend.title.alpha |
The alpha transparency of the title of the legend. |
legend.xlab.color |
The color of the xlab of the legend. |
legend.xlab.size |
The size of the xlab of the legend. |
legend.xlab.fontface |
The font face of the xlab of the legend. See |
legend.xlab.fontfamily |
The font family of the xlab of the legend. See |
legend.xlab.alpha |
The alpha transparency of the xlab of the legend. |
legend.ylab.color |
The color of the ylab of the legend. |
legend.ylab.size |
The size of the ylab of the legend. |
legend.ylab.fontface |
The font face of the ylab of the legend. See |
legend.ylab.fontfamily |
The font family of the ylab of the legend. See |
legend.ylab.alpha |
The alpha transparency of the ylab of the legend. |
legend.text.color |
The color of the text of the legend. |
legend.text.size |
The size of the text of the legend. |
legend.text.fontface |
The font face of the text of the legend. See |
legend.text.fontfamily |
The font family of the text of the legend. See |
legend.text.alpha |
The alpha transparency of the text of the legend. |
legend.frame |
The frame of the legend. |
legend.frame.color |
The color of the frame of the legend. |
legend.frame.alpha |
The alpha transparency of the frame of the legend. |
legend.frame.lwd |
The line width of the frame of the legend. See |
legend.frame.r |
The r (radius) of the frame of the legend. |
legend.bg |
The bg of the legend. |
legend.bg.color |
The color of the bg of the legend. |
legend.bg.alpha |
The alpha transparency of the bg of the legend. |
legend.only |
The only of the legend. |
legend.absolute_fontsize |
The absolute fontsize of the legend. So far, only used to calculate legend dimensions |
legend.settings.standard.portrait |
The portrait of the standard of the settings of the legend. |
legend.settings.standard.landscape |
The landscape of the standard of the settings of the legend. |
add_legend.position |
The position of the add_legend. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
chart.show |
The visibility of the chart. |
chart.plot.axis.x |
The x of the axis of the plot of the chart. |
chart.plot.axis.y |
The y of the axis of the plot of the chart. |
chart.position |
The position of the chart. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
chart.width |
The width of the chart. |
chart.height |
The height of the chart. |
chart.reverse |
The reverse of the chart. |
chart.na.show |
The visibility of the na of the chart. |
chart.title.color |
The color of the title of the chart. |
chart.title.size |
The size of the title of the chart. |
chart.title.fontface |
The font face of the title of the chart. See |
chart.title.fontfamily |
The font family of the title of the chart. See |
chart.title.alpha |
The alpha transparency of the title of the chart. |
chart.xlab.color |
The color of the xlab of the chart. |
chart.xlab.size |
The size of the xlab of the chart. |
chart.xlab.fontface |
The font face of the xlab of the chart. See |
chart.xlab.fontfamily |
The font family of the xlab of the chart. See |
chart.xlab.alpha |
The alpha transparency of the xlab of the chart. |
chart.ylab.color |
The color of the ylab of the chart. |
chart.ylab.size |
The size of the ylab of the chart. |
chart.ylab.fontface |
The font face of the ylab of the chart. See |
chart.ylab.fontfamily |
The font family of the ylab of the chart. See |
chart.ylab.alpha |
The alpha transparency of the ylab of the chart. |
chart.text.color |
The color of the text of the chart. |
chart.text.size |
The size of the text of the chart. |
chart.text.fontface |
The font face of the text of the chart. See |
chart.text.fontfamily |
The font family of the text of the chart. See |
chart.text.alpha |
The alpha transparency of the text of the chart. |
chart.frame |
The frame of the chart. |
chart.frame.color |
The color of the frame of the chart. |
chart.frame.alpha |
The alpha transparency of the frame of the chart. |
chart.frame.lwd |
The line width of the frame of the chart. See |
chart.frame.r |
The r (radius) of the frame of the chart. |
chart.bg |
The bg of the chart. |
chart.bg.color |
The color of the bg of the chart. |
chart.bg.alpha |
The alpha transparency of the bg of the chart. |
chart.object.color |
The color of the object of the chart. |
title.size |
The size of the title. |
title.color |
The color of the title. |
title.fontface |
The font face of the title. See |
title.fontfamily |
The font family of the title. See |
title.alpha |
The alpha transparency of the title. |
title.padding |
The padding of the title. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
title.frame |
The frame of the title. |
title.frame.color |
The color of the frame of the title. |
title.frame.alpha |
The alpha transparency of the frame of the title. |
title.frame.lwd |
The line width of the frame of the title. See |
title.frame.r |
The r (radius) of the frame of the title. |
title.position |
The position of the title. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
title.width |
The width of the title. |
credits.size |
The size of the credits. |
credits.color |
The color of the credits. |
credits.fontface |
The font face of the credits. See |
credits.fontfamily |
The font family of the credits. See |
credits.alpha |
The alpha transparency of the credits. |
credits.padding |
The padding of the credits. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
credits.position |
The position of the credits. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
credits.width |
The width of the credits. |
credits.height |
The height of the credits. |
compass.north |
The north of the compass. |
compass.type |
The type of the compass. |
compass.text.size |
The size of the text of the compass. |
compass.size |
The size of the compass. |
compass.show.labels |
The labels of the show of the compass. |
compass.cardinal.directions |
The directions of the cardinal of the compass. |
compass.text.color |
The color of the text of the compass. |
compass.color.dark |
The dark of the color of the compass. |
compass.color.light |
The light of the color of the compass. |
compass.lwd |
The line width of the compass. See |
compass.margins |
The margins of the compass. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
compass.position |
The position of the compass. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset.position |
The position of the inset. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
logo.height |
The height of the logo. |
logo.margins |
The margins of the logo. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
logo.between_margin |
The between_margin of the logo. |
logo.position |
The position of the logo. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset_map.height |
The height of the inset_map. |
inset_map.width |
The width of the inset_map. |
inset_map.margins |
The margins of the inset_map. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inset_map.between_margin |
The between_margin of the inset_map. |
inset_map.position |
The position of the inset_map. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset_map.frame |
The frame of the inset_map. |
inset.height |
The height of the inset. |
inset.width |
The width of the inset. |
inset.margins |
The margins of the inset. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inset.between_margin |
The between_margin of the inset. |
inset.frame |
The frame of the inset. |
inset.bg |
The bg of the inset. |
inset.bg.color |
The color of the bg of the inset. |
inset.bg.alpha |
The alpha transparency of the bg of the inset. |
inset_grob.height |
The height of the inset_grob. |
inset_grob.width |
The width of the inset_grob. |
inset_gg.height |
The height of the inset_gg. |
inset_gg.width |
The width of the inset_gg. |
scalebar.breaks |
See |
scalebar.width |
See |
scalebar.allow_clipping |
See |
scalebar.text.size |
The size of the text of the scalebar. |
scalebar.text.color |
The color of the text of the scalebar. |
scalebar.text.fontface |
The font face of the text of the scalebar. See |
scalebar.text.fontfamily |
The font family of the text of the scalebar. See |
scalebar.color.dark |
The dark of the color of the scalebar. |
scalebar.color.light |
The light of the color of the scalebar. |
scalebar.lwd |
The line width of the scalebar. See |
scalebar.size |
The size of the scalebar. |
scalebar.margins |
The margins of the scalebar. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
scalebar.position |
The position of the scalebar. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
grid.show |
The visibility of the grid. |
grid.labels.pos |
The pos of the labels of the grid. |
grid.x |
The x of the grid. |
grid.y |
The y of the grid. |
grid.n.x |
The x of the n of the grid. |
grid.n.y |
The y of the n of the grid. |
grid.crs |
The coordinate reference system (CRS) of the grid. |
grid.col |
The color of the grid. |
grid.lwd |
The line width of the grid. See |
grid.alpha |
The alpha transparency of the grid. |
grid.labels.show |
The visibility of the labels of the grid. |
grid.labels.size |
The size of the labels of the grid. |
grid.labels.col |
The color of the labels of the grid. |
grid.labels.fontface |
The font face of the labels of the grid. See |
grid.labels.fontfamily |
The font family of the labels of the grid. See |
grid.labels.rot |
The rot of the labels of the grid. |
grid.labels.format |
The format of the labels of the grid. |
grid.labels.cardinal |
The cardinal of the labels of the grid. |
grid.labels.margin.x |
The x of the margin of the labels of the grid. |
grid.labels.margin.y |
The y of the margin of the labels of the grid. |
grid.labels.space.x |
The x of the space of the labels of the grid. |
grid.labels.space.y |
The y of the space of the labels of the grid. |
grid.labels.inside_frame |
The inside_frame of the labels of the grid. |
grid.ticks |
The ticks of the grid. |
grid.lines |
The lines of the grid. |
grid.ndiscr |
The ndiscr of the grid. |
mouse_coordinates.position |
The position of the mouse_coordinates. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
minimap.server |
The server of the minimap. |
minimap.toggle |
The toggle of the minimap. |
minimap.position |
The position of the minimap. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
panel.show |
The visibility of the panel. |
panel.labels |
The labels of the panel. |
panel.label.size |
The size of the label of the panel. |
panel.label.color |
The color of the label of the panel. |
panel.label.fontface |
The font face of the label of the panel. See |
panel.label.fontfamily |
The font family of the label of the panel. See |
panel.label.alpha |
The alpha transparency of the label of the panel. |
panel.label.bg |
The bg of the label of the panel. |
panel.label.bg.color |
The color of the bg of the label of the panel. |
panel.label.bg.alpha |
The alpha transparency of the bg of the label of the panel. |
panel.label.frame |
The frame of the label of the panel. |
panel.label.frame.color |
The color of the frame of the label of the panel. |
panel.label.frame.alpha |
The alpha transparency of the frame of the label of the panel. |
panel.label.frame.lwd |
The line width of the frame of the label of the panel. See |
panel.label.frame.r |
The r (radius) of the frame of the label of the panel. |
panel.label.height |
The height of the label of the panel. |
panel.label.rot |
Rotation angles of the panel labels. Vector of four values that determine the panel label rotation when they are placed left, top, right, and bottom. The default angles are 90, 0, 270 and 0 respectively. Note that the second value is the most common, since labels are by default shown on top (see |
qtm.scalebar |
The scalebar of the qtm. |
qtm.minimap |
The minimap of the qtm. |
qtm.mouse_coordinates |
The mouse_coordinates of the qtm. |
earth_boundary |
The earth boundary |
earth_boundary.color |
The color of the earth_boundary. |
earth_boundary.lwd |
The line width of the earth_boundary. See |
earth_datum |
Earth datum |
space.color |
The color of the space. |
check_and_fix |
Should attempt to fix an invalid shapefile |
basemap.show |
The visibility of the basemap. |
basemap.server |
The server of the basemap. |
basemap.alpha |
The alpha transparency of the basemap. |
basemap.zoom |
The zoom of the basemap. |
tiles.show |
The visibility of the tiles. |
tiles.server |
The server of the tiles. |
tiles.alpha |
The alpha transparency of the tiles. |
tiles.zoom |
The zoom of the tiles. |
attr.color |
The color of the attr. |
crs_extra |
Only used internally (work in progress) |
crs_global |
The used crs for world maps |
crs_basemap |
The crs_basemap of the . |
title |
deprecated See |
main.title |
deprecated See |
main.title.size , main.title.color , main.title.fontface , main.title.fontfamily , main.title.position |
deprecated. Use the |
fontface , fontfamily |
renamed to |
style |
style see |
... |
List of tmap options to be set, or option names (characters) to be returned (see details) |
See Also
Vignette about layout, vignette about margins and aspect ratio and vignette about options
tmap layout: helper functions
Description
tmap layout: helper functions
Usage
tm_place_legends_right(width = NA)
tm_place_legends_left(width = NA)
tm_place_legends_bottom(height = NA)
tm_place_legends_top(height = NA)
tm_place_legends_inside(pos.h = NULL, pos.v = NULL)
tm_extra_inner_margin(left = 0, right = 0, top = 0, bottom = 0)
Arguments
width |
width |
height |
height |
pos.h , pos.v |
position (horizontal and vertical) |
left , right , top , bottom |
extra margins |
Plot mode options
Description
Plot mode options. This option is specific to the plot mode.
Usage
tm_plot(use_gradient, limit_latitude_3857)
Arguments
use_gradient |
Use gradient fill using linearGradient() |
limit_latitude_3857 |
Vector of two limit latitude values for maps printed in Web Mercator projection (EPSG 3857). If |
Determine plotting order of features
Description
Determine plotting order of features.
Usage
tm_plot_order(
aes,
reverse = TRUE,
na.order = c("mix", "bottom", "top"),
null.order = c("bottom", "mix", "top"),
null.below.na = TRUE
)
Arguments
aes |
Visual variable for which the values determine the plotting order.
Example: bubble map where the |
reverse |
Logical that determines whether the visual values are plotted
in reversed order. The visual values (specified with tmap option |
na.order |
Where should features be plotted that have an |
null.order |
Where should non-selected (aka null) features be plotted? |
null.below.na |
Should null features be plotted below NA features? |
Map layer: polygons
Description
Map layer that draws polygons. Supported visual variables are: fill
(the fill color),
col
(the border color), lwd
(line width), lty
(line type),
fill_alpha
(fill color alpha transparency) and col_alpha
(border color alpha transparency).
Usage
tm_polygons(
fill = tm_const(),
fill.scale = tm_scale(),
fill.legend = tm_legend(),
fill.chart = tm_chart_none(),
fill.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
lwd = tm_const(),
lwd.scale = tm_scale(),
lwd.legend = tm_legend(),
lwd.chart = tm_chart_none(),
lwd.free = NA,
lty = tm_const(),
lty.scale = tm_scale(),
lty.legend = tm_legend(),
lty.chart = tm_chart_none(),
lty.free = NA,
fill_alpha = tm_const(),
fill_alpha.scale = tm_scale(),
fill_alpha.legend = tm_legend(),
fill_alpha.chart = tm_chart_none(),
fill_alpha.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
linejoin = "round",
lineend = "round",
plot.order = tm_plot_order("lwd", reverse = TRUE, na.order = "bottom"),
zindex = NA,
group = NA,
group.control = "check",
popup.vars = NA,
popup.format = list(),
hover = NA,
id = "",
options = opt_tm_polygons(),
...
)
tm_fill(...)
tm_borders(col = tm_const(), ...)
opt_tm_polygons(polygons.only = "ifany")
Arguments
fill , fill.scale , fill.legend , fill.chart , fill.free |
Visual variable that determines the fill color. See details. |
col , col.scale , col.legend , col.chart , col.free |
Visual variable that determines the color. See details. |
lwd , lwd.scale , lwd.legend , lwd.chart , lwd.free |
Visual variable that determines the line width. See details. |
lty , lty.scale , lty.legend , lty.chart , lty.free |
Visual variable that determines the line type. See details. |
fill_alpha , fill_alpha.scale , fill_alpha.chart , fill_alpha.legend , fill_alpha.free |
Visual variable that determines the fill color transparency. See details. |
col_alpha , col_alpha.scale , col_alpha.legend , col_alpha.chart , col_alpha.free |
Visual variable that determines the color transparency. See details. |
linejoin , lineend |
Line join and line end. See gpar() for details. |
plot.order |
Specification in which order the spatial features are drawn.
See |
zindex |
Map layers are drawn on top of each other. The |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how layer groups
can be switched on and off. Options: |
popup.vars |
names of data variables that are shown in the popups
in |
popup.format |
list of formatting options for the popup values.
See the argument |
hover |
name of the data variable that specifies the hover labels (view mode only). Set to |
id |
name of the data variable that specifies the indices of the spatial
features. Only used for |
options |
options passed on to the corresponding |
... |
to catch deprecated arguments from version < 4.0 |
polygons.only |
should only polygon geometries of the shape object (defined in |
Details
The visual variable arguments (e.g. col
) can be specified with either a data
variable name (e.g., a spatial vector attribute or a raster layer of the object
specified in tm_shape()
), or with a visual value (for col
, a color is expected).
See vignette about visual variables.
Multiple values can be specified: in that case facets are created.
These facets can be combined with other faceting data variables, specified with tm_facets()
.
See vignette about facets.
The
*.scale
arguments determine the used scale to map the data values to visual variable values. These can be specified with one of the availabletm_scale_*()
functions. The default is specified by the tmap option (tm_options()
)scales.var
. See vignette about scales.The
*.legend
arguments determine the used legend, specified withtm_legend()
. The default legend and its settings are determined by the tmap options (tm_options()
)legend.
. See vignette about legends.The
*.chart
arguments specify additional charts, specified withtm_chart_
, e.g.tm_chart_histogram()
. See vignette about charts.The
*.free
arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (seetm_facets()
). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid (tm_facets_grid()
). For instance,col.free = c(TRUE, FALSE, FALSE)
means that for the visual variablecol
, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks (tm_facets_wrap()
andtm_facets_stack()
) there is only one facet dimension, so the*.free
argument requires only one logical value.
See Also
Choropleth example (1) and choropleth example (2)
Examples
# load Africa country data
data(World)
Africa = World[World$continent == "Africa", ]
Africa_border = sf::st_make_valid(sf::st_union(sf::st_buffer(Africa, 0.001))) # slow and ugly
# without specifications
tm_shape(Africa_border) + tm_polygons()
tm_shape(Africa_border) + tm_fill()
tm_shape(Africa_border) + tm_borders()
# specification with visual variable values
tm_shape(Africa) +
tm_polygons(fill = "limegreen", col = "purple", lwd = 2, lty = "solid", col_alpha = 0.3) +
tm_text("name", options = opt_tm_text(remove_overlap = TRUE)) +
tm_shape(Africa_border) +
tm_borders("darkred", lwd = 3)
# specification with a data variable
tm_shape(Africa) +
tm_polygons(fill = "income_grp", fill.scale = tm_scale_categorical(values = "-tol.muted"))
# continuous color scale with landscape legend
tm_shape(Africa) +
tm_polygons(fill = "inequality",
fill.scale = tm_scale_continuous(values = "-scico.roma"),
fill.legend = tm_legend(
title = "", orientation = "landscape",
position = tm_pos_out("center", "bottom"), frame = FALSE
)) +
tm_shape(Africa_border) +
tm_borders(lwd = 2) +
tm_title("Inequality index", position = tm_pos_in("right", "TOP"), frame = FALSE) +
tm_layout(frame = FALSE)
# bivariate scale
tm_shape(World) +
tm_polygons(tm_vars(c("inequality", "well_being"), multivariate = TRUE))
Set the position of map components
Description
Set the position of map components, such as legends, title, compass, scale bar, etc.
tm_pos()
is the function to position these components:
tm_pos_out()
places the components outside the map area, tm_pos_in()
inside the map area, and tm_pos_on_top()
on top of the map
Each position
argument of a map layer or component should be specified with
one of these functions.
The functions tm_pos_auto_out()
and tm_pos_auto_in()
are used to set the components automatically, and should be used
via tmap_options()
. See Details how the positioning works.
Usage
tm_pos(cell.h, cell.v, pos.h, pos.v, align.h, align.v, just.h, just.v)
tm_pos_in(pos.h, pos.v, align.h, align.v, just.h, just.v)
tm_pos_out(cell.h, cell.v, pos.h, pos.v, align.h, align.v, just.h, just.v)
tm_pos_on_top(pos.h, pos.v, align.h, align.v, just.h, just.v)
tm_pos_auto_out(cell.h, cell.v, pos.h, pos.v, align.h, align.v, just.h, just.v)
tm_pos_auto_in(align.h, align.v, just.h, just.v)
Arguments
cell.h , cell.v |
The plotting area is overlaid with a 3x3 grid, of which
the middle grid cell is the map area. Components can be drawn into any cell.
|
pos.h , pos.v |
The position of the component within the cell.
The main options for |
align.h , align.v |
The alignment of the component in case multiple components are stacked.
When they are stacked horizontally, |
just.h , just.v |
The justification of the components.
Only used in case |
Details
tm_pos_in()
sets the position of the component(s) inside the maps area,
which is equivalent to the center-center cell (in case there are facets,
these are all drawn in this center-center cell).
tm_pos_out()
sets the position of the component(s) outside the map.
tm_pos_on_top()
is the same as tm_pos_out
, but with the cell set to the center cell
It may be therefore seem similar to tm_pos_in()
, but with an essential difference:
tm_pos_in()
takes the map frame into account whereas tm_pos_on_top()
does not.
#'
The amount of space that the top and bottom rows, and left and right columns
occupy is determined by the tm_layout()
arguments meta.margins
and meta.auto_margins
.
The former sets the relative space of the bottom, left, top, and right side.
In case these are set to NA
, the space is set automatically based on 1)
the maximum relative space specified by meta.auto_margins
and 2)
the presence and size of components in each cell.
For instance, if there is one landscape oriented legend in the center-bottom cell,
then the relative space of the bottom row is set to the height of that legend
(given that it is smaller than the corresponding value of meta.auto_margins
),
while the other four sides are set to 0.
tm_pos_auto_out()
is more complex: the cell.h
and cell.v
arguments should be set
to one of the four corners. It does not mean that the components are drawn in a corner.
The corner represents the sides of the map that the components are drawn.
By default, legends are drawn either at the bottom or on the right-side of
the map by default (see tmap_options("legend.position")
).
Only when there are row- and column-wise legends and a general legend (using tm_facets_grid()
),
the general legend is drawn in the corner, but in practice this case will be rare.
The arguments pos.h
and pos.v
determine where the components are drawn within the cell.
Again, with "left"
, "center"
, and "right"
for pos.h
and "top"
, "center"
, and "bottom"
for pos.v
.
The values can also be specified in upper-case, which influences the offset
with the cell borders, which is determined by tmap option component.offset
.
By default, there is a small offset when components are drawn inside and no
offset when they are drawn outside or with upper-case.
tm_pos_auto_in()
automatically determines pos.h
and pos.v
given the
available space inside the map. This is similar to the default positioning in tmap3.
In case multiple components are draw in the same cell and the same position
inside that cell, they are stacked (determined which the stack
argument in
the legend or component function). The align.h
and align.v
arguments
determine how these components will be justified with each other.
Note that legends and components may be different for a facet row or column.
This is the case when tm_facets_grid()
or tm_facets_stack()
are applied
and when scales are set to free (with the .free
argument of the map layer functions).
In case a legends or components are draw row- or column wise, and the position
of the legends (or components) is right next to the maps, these legends
(or components) will be aligned with the maps.
See Also
Map layer: raster
Description
Map layer that draws rasters. Supported visual variable is: col
(the color).
Usage
tm_raster(
col = tm_vars(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_raster(),
...
)
opt_tm_raster(interpolate = FALSE)
Arguments
col , col.scale , col.legend , col.chart , col.free |
Visual variable that determines the color. See details. |
col_alpha , col_alpha.scale , col_alpha.legend , col_alpha.chart , col_alpha.free |
Visual variable that determines the color transparency. See details. |
zindex |
Map layers are drawn on top of each other. The |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how layer groups
can be switched on and off. Options: |
options |
options passed on to the corresponding |
... |
to catch deprecated arguments from version < 4.0 |
interpolate |
Should the raster image be interpolated? Currently only applicable in view mode (passed on to |
Details
The visual variable arguments (e.g. col
) can be specified with either a data
variable name (e.g., a spatial vector attribute or a raster layer of the object
specified in tm_shape()
), or with a visual value (for col
, a color is expected).
See vignette about visual variables.
Multiple values can be specified: in that case facets are created.
These facets can be combined with other faceting data variables, specified with tm_facets()
.
See vignette about facets.
The
*.scale
arguments determine the used scale to map the data values to visual variable values. These can be specified with one of the availabletm_scale_*()
functions. The default is specified by the tmap option (tm_options()
)scales.var
. See vignette about scales.The
*.legend
arguments determine the used legend, specified withtm_legend()
. The default legend and its settings are determined by the tmap options (tm_options()
)legend.
. See vignette about legends.The
*.chart
arguments specify additional charts, specified withtm_chart_
, e.g.tm_chart_histogram()
. See vignette about charts.The
*.free
arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (seetm_facets()
). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid (tm_facets_grid()
). For instance,col.free = c(TRUE, FALSE, FALSE)
means that for the visual variablecol
, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks (tm_facets_wrap()
andtm_facets_stack()
) there is only one facet dimension, so the*.free
argument requires only one logical value.
Examples
## Not run:
# load land data
data(land, World)
tm_shape(land) +
tm_raster("cover")
tm_shape(land) +
tm_raster("elevation", col.scale = tm_scale_continuous(values = terrain.colors(9))) +
tm_shape(World) +
tm_borders()
## End(Not run)
Map layer: rgb images
Description
Map layer that an rgb image.. The used (multivariate) visual variable is col
,
which should be specified with 3 or 4 variables for tm_rgb()
and tm_rgba()
respectively.
The first three correspond to the red, green, and blue channels. The optional
fourth is the alpha transparency channel.
Usage
tm_rgb(
col = tm_vars(n = 3, multivariate = TRUE),
col.scale = tm_scale_rgb(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
options = opt_tm_rgb(),
...
)
tm_rgba(
col = tm_vars(n = 4, multivariate = TRUE),
col.scale = tm_scale_rgba(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
options = opt_tm_rgb()
)
opt_tm_rgb(interpolate = FALSE, saturation = 1)
Arguments
col , col.scale , col.legend , col.chart , col.free |
Visual variable that determines
the color. |
col_alpha , col_alpha.scale , col_alpha.legend , col_alpha.chart , col_alpha.free |
Visual variable that determines the color transparency. See details. |
options |
options passed on to the corresponding |
... |
to catch deprecated arguments from version < 4.0 |
interpolate |
Should the raster image be interpolated? Currently only applicable in view mode (passed on to |
saturation |
The saturation of the rgb. |
Examples
## Not run:
require(stars)
file = system.file("tif/L7_ETMs.tif", package = "stars")
L7 = stars::read_stars(file)
tm_shape(L7) +
tm_rgb()
# the previous example was a shortcut of this call
tm_shape(L7) +
tm_rgb(col = tm_vars("band", dimvalues = 1:3, multivariate = TRUE))
# alternative format: using a stars dimension instead of attributes
L7_alt = split(L7, "band")
tm_shape(L7_alt) +
tm_rgb()
# with attribute names
tm_shape(L7_alt) +
tm_rgb(col = tm_vars(c("X1", "X2", "X3"), multivariate = TRUE))
# with attribute indices
tm_shape(L7_alt) +
tm_rgb(col = tm_vars(1:3, multivariate = TRUE))
if (requireNamespace("terra")) {
L7_terra = terra::rast(file)
tm_shape(L7_terra) +
tm_rgb()
# with layer names
tm_shape(L7_terra) +
tm_rgb(tm_vars(names(L7_terra)[1:3], multivariate = TRUE))
# with layer indices
tm_shape(L7_alt) +
tm_rgb(col = tm_vars(1:3, multivariate = TRUE))
}
## End(Not run)
Scales: automatic scale
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the
layer functions (e.g. fill.scale
in tm_polygons()
). The function tm_scale()
is a scale that is set automatically given by the data type (factor, numeric, and integer)
and the visual variable. The tmap option scales.var
contains information
which scale is applied when.
Usage
tm_scale(...)
Arguments
... |
arguments passed on to the applied scale function |
See Also
tm_scale_asis()
, tm_scale_ordinal()
, tm_scale_categorical()
,
tm_scale_intervals()
, tm_scale_discrete()
, tm_scale_continuous()
,
tm_scale_rank()
, tm_scale_continuous_log()
, tm_scale_continuous_log2()
,
tm_scale_continuous_log10()
, tm_scale_continuous_log1p()
, tm_scale_continuous_sqrt()
,
tm_scale_continuous_pseudo_log()
, tm_scale_rgb()
, tm_scale_bivariate()
Scales: as is
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the
layer functions (e.g. fill.scale
in tm_polygons()
).
The function tm_scale_asis()
is used to take data values as they are and use them as such for the visual variable.
Usage
tm_scale_asis(values.scale = NA, value.neutral = NA, value.na = NA, ...)
Arguments
values.scale |
(generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as |
value.neutral |
(generic scale argument) Value that can be considered neutral. This is used for legends of other visual variables of the same map layer. E.g. when both |
value.na |
(generic scale argument) Value used for missing values. See tmap option |
... |
Arguments caught (and not used) from the automatic function |
See Also
Map component: scale bar
Description
This function was renamed to tm_scalebar()
in tmap v4.0.
Usage
tm_scale_bar(...)
Arguments
... |
Arguments passed on to
|
Scales: bivariate scale
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the
layer functions (e.g. fill.scale
in tm_polygons()
).
The function tm_scale_bivariate()
is used for bivariate.scales
.
Usage
tm_scale_bivariate(
scale1 = tm_scale(),
scale2 = tm_scale(),
values = NA,
values.repeat = FALSE,
values.range = NA,
values.scale = 1,
value.na = NA,
value.null = NA,
value.neutral = NA,
labels = NULL,
label.na = NA,
label.null = NA
)
Arguments
scale1 , scale2 |
two |
values |
(generic scale argument) The visual values. For colors
(e.g. |
values.repeat |
(generic scale argument) Should the values be repeated in case there are more categories? |
values.range |
(generic scale argument) Range of the values. Vector of two numbers (both between 0 and 1) where the first determines the minimum and the second the maximum.
Full range, which means that all values are used, is encoded as |
values.scale |
(generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as |
value.na |
(generic scale argument) Value used for missing values. See tmap option |
value.null |
(generic scale argument) Value used for NULL values.
See tmap option |
value.neutral |
(generic scale argument) Value that can be considered neutral.
This is used for legends of other visual variables of the same map layer.
E.g. when both |
labels |
(generic scale argument) Labels |
label.na |
(generic scale argument) Label for missing values |
label.null |
(generic scale argument) Label for null (out-of-scope) values |
See Also
Scales: continuous scale
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the layer
functions (e.g. fill.scale
in tm_polygons()
).
The function tm_scale_continuous()
is used for continuous data.
The functions tm_scale_continuous_<x>()
use transformation functions x.
Usage
tm_scale_continuous(
n = NULL,
limits = NULL,
outliers.trunc = NULL,
ticks = NULL,
trans = NULL,
midpoint = NULL,
values = NA,
values.repeat = FALSE,
values.range = NA,
values.scale = NA,
value.na = NA,
value.null = NA,
value.neutral = NA,
labels = NULL,
label.na = NA,
label.null = NA,
label.format = list(),
trans.args = list()
)
tm_scale_continuous_log(..., base = exp(1))
tm_scale_continuous_log2(...)
tm_scale_continuous_log10(...)
tm_scale_continuous_log1p(...)
tm_scale_continuous_sqrt(...)
tm_scale_continuous_pseudo_log(..., base = exp(1), sigma = 1)
Arguments
n |
Preferred number of tick labels. Only used if |
limits |
Limits of the data values that are mapped to the continuous scale. When |
outliers.trunc |
Should outliers be truncated? An outlier is a data value that is below or above the respectively lower and upper limit. A logical vector of two values is expected. The first and second value determines whether values lower than the lower limit respectively higher than the upper limit are truncated to the lower respectively upper limit. If |
ticks |
Tick values. If not specified, it is determined automatically with |
trans |
Transformation function. One of |
midpoint |
The data value that is interpreted as the midpoint. By default it is set to 0 if negative and positive values are present. Useful when values are diverging colors. In that case, the two sides of the color palette are assigned to negative respectively positive values. If all values are positive or all values are negative, then the midpoint is set to |
values |
(generic scale argument) The visual values. For colors (e.g. |
values.repeat |
(generic scale argument) Should the values be repeated in case there are more categories? |
values.range |
(generic scale argument) Range of the values, especially useful for color palettes. Vector of two numbers (both between 0 and 1) where the first determines the minimum and the second the maximum. Full range, which means that all values are used, is encoded as |
values.scale |
(generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as |
value.na |
(generic scale argument) Value used for missing values. See tmap option |
value.null |
(generic scale argument) Value used for NULL values. See tmap option |
value.neutral |
(generic scale argument) Value that can be considered neutral. This is used for legends of other visual variables of the same map layer. E.g. when both |
labels |
(generic scale argument) Labels |
label.na |
(generic scale argument) Label for missing values |
label.null |
(generic scale argument) Label for null (out-of-scope) values |
label.format |
(generic scale argument) Label formatting (similar to |
trans.args |
list of additional argument for the transformation (generic transformation arguments) |
... |
passed on to |
base |
base of logarithm |
sigma |
Scaling factor for the linear part of pseudo-log transformation. |
See Also
Examples
tm_shape(World) +
tm_polygons(
fill = "HPI",
fill.scale = tm_scale_continuous(values = "scico.roma", midpoint = 30))
tm_shape(metro) +
tm_bubbles(
size = "pop1950",
size.scale = tm_scale_continuous(
values.scale = 1),
size.legend = tm_legend("Population in 1950", frame = FALSE))
tm_shape(metro) +
tm_bubbles(
size = "pop1950",
size.scale = tm_scale_continuous(
values.scale = 2,
limits = c(0, 12e6),
ticks = c(1e5, 3e5, 8e5, 4e6, 1e7),
labels = c("0 - 200,000", "200,000 - 500,000", "500,000 - 1,000,000",
"1,000,000 - 10,000,000", "10,000,000 or more"),
outliers.trunc = c(TRUE, TRUE)),
size.legend = tm_legend("Population in 1950", frame = FALSE))
# Note that for this type of legend, we recommend tm_scale_intervals()
Scales: discrete scale
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the
layer functions (e.g. fill.scale
in tm_polygons()
).
The function tm_scale_discrete()
is used for discrete numerical data, such as integers.
Usage
tm_scale_discrete(
ticks = NA,
midpoint = NULL,
values = NA,
values.repeat = FALSE,
values.range = NA,
values.scale = NA,
value.na = NA,
value.null = NA,
value.neutral = NA,
labels = NULL,
label.na = NA,
label.null = NA,
label.format = list()
)
Arguments
ticks |
Discrete values. If not specified, it is determined automatically: unique values are put on a discrete scale. |
midpoint |
The data value that is interpreted as the midpoint. By default it is set to 0 if negative and positive values are present. Useful when values are diverging colors. In that case, the two sides of the color palette are assigned to negative respectively positive values. If all values are positive or all values are negative, then the midpoint is set to |
values |
(generic scale argument) The visual values. For colors (e.g. |
values.repeat |
(generic scale argument) Should the values be repeated in case there are more categories? |
values.range |
(generic scale argument) Range of the values. Vector of two numbers (both between 0 and 1) where the first determines the minimum and the second the maximum. Full range, which means that all values are used, is encoded as |
values.scale |
(generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as |
value.na |
(generic scale argument) Value used for missing values. See tmap option |
value.null |
(generic scale argument) Value used for NULL values. See tmap option |
value.neutral |
(generic scale argument) Value that can be considered neutral. This is used for legends of other visual variables of the same map layer. E.g. when both |
labels |
(generic scale argument) Labels |
label.na |
(generic scale argument) Label for missing values |
label.null |
(generic scale argument) Label for null (out-of-scope) values |
label.format |
(generic scale argument) Label formatting (similar to |
See Also
Scales: interval scale
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the
layer functions (e.g. fill.scale
in tm_polygons()
).
The function tm_scale_intervals()
is used for numerical data.
Usage
tm_scale_intervals(
n = 5,
style = ifelse(is.null(breaks), "pretty", "fixed"),
style.args = list(),
breaks = NULL,
interval.closure = "left",
midpoint = NULL,
as.count = FALSE,
values = NA,
values.repeat = FALSE,
values.range = NA,
values.scale = NA,
value.na = NA,
value.null = NA,
value.neutral = NA,
labels = NULL,
label.na = NA,
label.null = NA,
label.format = list()
)
Arguments
n |
Number of intervals. For some styles (see argument |
style |
Method to create intervals. Options are |
style.args |
List of extra arguments passed on to |
breaks |
Interval breaks (only used and required when |
interval.closure |
value that determines whether where the intervals are closed: |
midpoint |
The data value that is interpreted as the midpoint. By default it is set to 0 if negative and positive values are present. Useful when values are diverging colors. In that case, the two sides of the color palette are assigned to negative respectively positive values. If all values are positive or all values are negative, then the midpoint is set to |
as.count |
Should the data variable be processed as a count variable? For instance, if |
values |
(generic scale argument) The visual values. For colors (e.g. |
values.repeat |
(generic scale argument) Should the values be repeated in case there are more categories? |
values.range |
(generic scale argument) Range of the values. Vector of two numbers (both between 0 and 1) where the first determines the minimum and the second the maximum. Full range, which means that all values are used, is encoded as |
values.scale |
(generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as |
value.na |
(generic scale argument) Value used for missing values. See tmap option |
value.null |
(generic scale argument) Value used for NULL values. See tmap option |
value.neutral |
(generic scale argument) Value that can be considered neutral. This is used for legends of other visual variables of the same map layer. E.g. when both |
labels |
(generic scale argument) Labels |
label.na |
(generic scale argument) Label for missing values |
label.null |
(generic scale argument) Label for null (out-of-scope) values |
label.format |
(generic scale argument) Label formatting (similar to legend.format in tmap3) |
See Also
Scales: categorical and ordinal scale
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the
layer functions (e.g. fill.scale
in tm_polygons()
).
The functions tm_scale_categorical()
and tm_scale_ordinal()
are used
for categorical data. The only difference between these functions is that the
former assumes unordered categories whereas the latter assumes ordered categories.
For colors (the visual variable fill
or col
), different default color
palettes are used (see the tmap option values.var
).
Usage
tm_scale_ordinal(
n.max = 30,
values = NA,
values.repeat = FALSE,
values.range = 1,
values.scale = NA,
value.na = NA,
value.null = NA,
value.neutral = NA,
levels = NULL,
levels.drop = FALSE,
labels = NULL,
label.na = NA,
label.null = NA,
label.format = list()
)
tm_scale_categorical(
n.max = 30,
values = NA,
values.repeat = TRUE,
values.range = NA,
values.scale = NA,
value.na = NA,
value.null = NA,
value.neutral = NA,
levels = NULL,
levels.drop = FALSE,
labels = NULL,
label.na = NA,
label.null = NA,
label.format = list()
)
Arguments
n.max |
Maximum number of categories (factor levels). In case there are more, they are grouped into |
values |
(generic scale argument) The visual values. For colors (e.g. |
values.repeat |
(generic scale argument) Should the values be repeated in case there are more categories? |
values.range |
(generic scale argument) Range of the values. Vector of two numbers (both between 0 and 1) where the first determines the minimum and the second the maximum. Full range, which means that all values are used, is encoded as |
values.scale |
(generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as |
value.na |
(generic scale argument) Value used for missing values. See tmap option |
value.null |
(generic scale argument) Value used for NULL values. See tmap option |
value.neutral |
(generic scale argument) Value that can be considered neutral. This is used for legends of other visual variables of the same map layer. E.g. when both |
levels |
Levels to show. Other values are treated as missing. |
levels.drop |
Should unused levels be dropped (and therefore are not assigned to a visual value and shown in the legend)? |
labels |
(generic scale argument) Labels |
label.na |
(generic scale argument) Label for missing values |
label.null |
(generic scale argument) Label for null (out-of-scope) values |
label.format |
(generic scale argument) Label formatting (similar to |
See Also
Scales: rank scale
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the layer
functions (e.g. fill.scale
in tm_polygons()
).
The function tm_scale_rank()
is used to rank numeric data.
Usage
tm_scale_rank(
n = NULL,
ticks = NULL,
values = NA,
values.repeat = FALSE,
values.range = NA,
values.scale = NA,
value.na = NA,
value.null = NA,
value.neutral = NA,
labels = NULL,
label.na = NA,
label.null = NA,
label.format = list(),
unit = "rank"
)
Arguments
n |
Preferred number of tick labels. Only used if |
ticks |
Tick values. If not specified, it is determined automatically with |
values |
(generic scale argument) The visual values. For colors (e.g. |
values.repeat |
(generic scale argument) Should the values be repeated in case there are more categories? |
values.range |
(generic scale argument) Range of the values, especially useful for color palettes. Vector of two numbers (both between 0 and 1) where the first determines the minimum and the second the maximum. Full range, which means that all values are used, is encoded as |
values.scale |
(generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as |
value.na |
(generic scale argument) Value used for missing values. See tmap option |
value.null |
(generic scale argument) Value used for NULL values. See tmap option |
value.neutral |
(generic scale argument) Value that can be considered neutral. This is used for legends of other visual variables of the same map layer. E.g. when both |
labels |
(generic scale argument) Labels |
label.na |
(generic scale argument) Label for missing values |
label.null |
(generic scale argument) Label for null (out-of-scope) values |
label.format |
(generic scale argument) Label formatting (similar to |
unit |
The unit name of the values. By default |
See Also
Scales: RGB
Description
Scales in tmap are configured by the family of functions with prefix tm_scale
.
Such function should be used for the input of the .scale
arguments in the layer
functions (e.g. fill.scale
in tm_polygons()
).
The function tm_scale_rgb()
is used to transform r, g, b band variables to colors. This function is adopted from (and works similar as) stars::st_rgb()
Usage
tm_scale_rgb(
value.na = NA,
stretch = FALSE,
probs = c(0, 1),
max_color_value = 255L
)
tm_scale_rgba(
value.na = NA,
stretch = FALSE,
probs = c(0, 1),
max_color_value = 255
)
Arguments
value.na |
value for missing values |
stretch |
should each (r, g, b) band be stretched? Possible values: |
probs |
probability (quantile) values when |
max_color_value |
maximum value |
See Also
tm_scale()
and stars::st_rgb()
Examples
## Not run:
require(stars)
file = system.file("tif/L7_ETMs.tif", package = "stars")
L7 = stars::read_stars(file)
tm_shape(L7) +
tm_rgb(col.scale = tm_scale_rgb(probs = c(0, .99), stretch = TRUE))
tm_shape(L7) +
tm_rgb(col.scale = tm_scale_rgb(stretch = "histogram"))
## End(Not run)
Map component: scale bar
Description
Map component that adds a scale bar.
Usage
tm_scalebar(
breaks,
width,
allow_clipping,
text.size,
text.color,
color.dark,
color.light,
lwd,
position,
group_id,
bg,
bg.color,
bg.alpha,
size = "deprecated",
stack,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
margins,
z
)
Arguments
breaks |
breaks. E.g. |
width |
width of the scale bar. Units are number of text line heights, which is similar to the number of characters. In case |
allow_clipping |
should clipping of the last label by allowed? If |
text.size |
text size |
text.color |
text.color |
color.dark |
color.dark |
color.light |
color.light |
lwd |
linewidth |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
bg |
Show background? |
bg.color |
Background color |
bg.alpha |
Background transparency |
size |
Deprecated (use |
stack |
stack with other map components, either |
frame |
frame should a frame be drawn? |
frame.color |
frame color |
frame.alpha |
frame alpha transparancy |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
margins |
margins |
z |
z index, e.g. the place of the component relative to the other componets |
See Also
Specify a numeric sequence
Description
Specify a numeric sequence, for numeric scales like tm_scale_continuous()
. This function is needed when there is a non-linear relationship between the numeric data values and the visual variables. E.g. to make relationship with the area of bubbles linear, the square root of input variables should be used to calculate the radius of the bubbles.
Usage
tm_seq(
from = 0,
to = 1,
power = c("lin", "sqrt", "sqrt_perceptual", "quadratic")
)
Arguments
from , to |
The numeric range, default 0 and 1 respectively |
power |
The power component, a number or or one of |
Details
The perceived area of larger symbols is often underestimated. Flannery (1971) experimentally derived a method to compensate this for symbols. This compensation is obtained by using the power exponent of 0.5716 instead of 0.5, or by setting power
to "sqrt_perceptual"
Map layer: simple features
Description
Map layer that draws simple features as they are. Supported visual variables
are: fill
(the fill color), col
(the border color), size
the point size,
shape
the symbol shape, lwd
(line width), lty
(line type), fill_alpha
(fill color alpha transparency)
and col_alpha
(border color alpha transparency).
Usage
tm_sf(
fill = tm_const(),
fill.scale = tm_scale(),
fill.legend = tm_legend(),
fill.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.free = NA,
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.free = NA,
shape = tm_const(),
shape.scale = tm_scale(),
shape.legend = tm_legend(),
shape.free = NA,
lwd = tm_const(),
lwd.scale = tm_scale(),
lwd.legend = tm_legend(),
lwd.free = NA,
lty = tm_const(),
lty.scale = tm_scale(),
lty.legend = tm_legend(),
lty.free = NA,
fill_alpha = tm_const(),
fill_alpha.scale = tm_scale(),
fill_alpha.legend = tm_legend(),
fill_alpha.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.free = NA,
linejoin = "round",
lineend = "round",
plot.order.list = list(polygons = tm_plot_order("AREA"), lines =
tm_plot_order("LENGTH"), points = tm_plot_order("size")),
options = opt_tm_sf(),
zindex = NA,
group = NA,
group.control = "check",
...
)
opt_tm_sf(
polygons.only = "yes",
lines.only = "yes",
points_only = "yes",
point_per = "feature",
points.icon.scale = 3,
points.just = NA,
points.grob.dim = c(width = 48, height = 48, render.width = 256, render.height = 256)
)
Arguments
fill , fill.scale , fill.legend , fill.free |
Visual variable that determines the fill color. See details. |
col , col.scale , col.legend , col.free |
Visual variable that determines the color. See details. |
size , size.scale , size.legend , size.free |
Visual variable that determines the size. See details. |
shape , shape.scale , shape.legend , shape.free |
Visual variable that determines the shape. See details. |
lwd , lwd.scale , lwd.legend , lwd.free |
Visual variable that determines the line width. See details. |
lty , lty.scale , lty.legend , lty.free |
Visual variable that determines the line type. See details. |
fill_alpha , fill_alpha.scale , fill_alpha.legend , fill_alpha.free |
Visual variable that determines the fill color transparency. See details. |
col_alpha , col_alpha.scale , col_alpha.legend , col_alpha.free |
Visual variable that determines the color transparency. See details. |
linejoin , lineend |
line join and line end. See gpar() for details. |
plot.order.list |
Specification in which order the spatial features are drawn.
This consists of a list of three elementary geometry types: for polygons, lines and, points.
For each of these types, which are drawn in that order, a |
options |
options passed on to the corresponding |
zindex |
Map layers are drawn on top of each other. The |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how layer groups
can be switched on and off. Options: |
... |
passed on to |
polygons.only |
should only polygon geometries of the shape object (defined in |
lines.only |
should only line geometries of the shape object (defined in |
points_only |
should only point geometries of the shape object (defined in |
point_per |
specification of how spatial points are mapped when the geometry is a multi line or a multi polygon. One of |
points.icon.scale |
scaling number that determines how large the icons (or grobs) are in plot mode in comparison to proportional symbols (such as bubbles). For view mode, use the argument |
points.just |
justification of the points relative to the point coordinates. Either one of the following values: |
points.grob.dim |
vector of four values that determine how grob objects (see details) are shown in view mode. The first and second value are the width and height of the displayed icon. The third and fourth value are the width and height of the rendered png image that is used for the icon. Generally, the third and fourth value should be large enough to render a ggplot2 graphic successfully. Only needed for the view mode. |
Details
The visual variable arguments (e.g. col
) can be specified with either a data
variable name (e.g., a spatial vector attribute or a raster layer of the object
specified in tm_shape()
), or with a visual value (for col
, a color is expected).
See vignette about visual variables.
Multiple values can be specified: in that case facets are created.
These facets can be combined with other faceting data variables, specified with tm_facets()
.
See vignette about facets.
The
*.scale
arguments determine the used scale to map the data values to visual variable values. These can be specified with one of the availabletm_scale_*()
functions. The default is specified by the tmap option (tm_options()
)scales.var
. See vignette about scales.The
*.legend
arguments determine the used legend, specified withtm_legend()
. The default legend and its settings are determined by the tmap options (tm_options()
)legend.
. See vignette about legends.The
*.chart
arguments specify additional charts, specified withtm_chart_
, e.g.tm_chart_histogram()
. See vignette about charts.The
*.free
arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (seetm_facets()
). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid (tm_facets_grid()
). For instance,col.free = c(TRUE, FALSE, FALSE)
means that for the visual variablecol
, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks (tm_facets_wrap()
andtm_facets_stack()
) there is only one facet dimension, so the*.free
argument requires only one logical value.
Examples
data(World)
World$geometry[World$continent == "Africa"] <-
sf::st_centroid(World$geometry[World$continent == "Africa"])
World$geometry[World$continent == "South America"] <-
sf::st_cast(World$geometry[World$continent == "South America"],
"MULTILINESTRING", group_or_split = FALSE)
tm_shape(World, crs = "+proj=robin") +
tm_sf()
Shape (spatial object) specification
Description
Specify a shape, which is a spatial object from one of these spatial object
class packages: sf
, stars
, or terra
.
Usage
tm_shape(
shp = NULL,
bbox = NULL,
crs = NULL,
is.main = NA,
name = NULL,
unit = NULL,
filter = NULL,
...
)
Arguments
shp |
Spatial object |
bbox |
Bounding box of the map (only used if |
crs |
Map projection (CRS). Can be set to an |
is.main |
Is |
name |
of the spatial object |
unit |
Unit of the coordinates |
filter |
Filter features |
... |
passed on to |
Details
The map projection (crs
) determines in which coordinate system the spatial object is processed and plotted.
See vignette about CRS. The crs
can be specified in two places: 1) tm_shape()
and tm_crs()
.
In both cases, the map is plotted into the specified crs
. The difference is that in the first option, the crs
is also taken into account in spatial transformation functions, such as the calculation of centroids and cartograms. In the second option, the crs
is only used in the plotting phase.
The automatic crs recommendation (which is still work-in-progress) is the following:
Property | Recommendation |
global (for world maps) | A pseudocylindrical projection tmap option crs_global , by default "eqearth (Equal Earth). See https://r-tmap.github.io/tmap/articles/41_advanced_crs.html for more options |
area (equal area) | Lambert Azimuthal Equal Area (laea ) |
distance (equidistant) | Azimuthal Equidistant (aeqd ) |
shape (conformal) | Stereographic (stere ) |
For further info about the available "generic" projects see: for utm: https://proj.org/en/9.4/operations/projections/utm.html for laea: https://proj.org/en/9.4/operations/projections/laea.html for aeqd: https://proj.org/en/9.4/operations/projections/aeqd.html for pconic: https://proj.org/en/9.4/operations/projections/pconic.html for eqdc: https://proj.org/en/9.4/operations/projections/eqdc.html
Note
as of tmap 4.0, simplify has been removed. Please use tmaptools::simplify_shape()
instead
See Also
Examples
tm_shape(World, crs = "auto") +
tm_polygons()
tm_shape(World, crs = 3035, bb = "Europe") +
tm_polygons()
tm_shape(World, crs = "+proj=robin", filter = World$continent=="Africa") +
tm_polygons()
Layout options
Description
Specify the layout of the maps. tm_layout()
is identical as tm_options()
but only contain the tmap options that are directly related to the layout. tm_style()
sets the style for the map. A style is a specified set of options (that can be changed afterwards with tm_layout()
). These functions are used within a plot a plot call (stacked with the +
operator). Their counterparts tmap_options()
and tmap_style()
can be used to set the (layout) options globally.
Usage
tm_style(style, ...)
tm_layout(
scale,
asp,
bg,
bg.color,
outer.bg,
outer.bg.color,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
frame.double_line,
outer.margins,
inner.margins,
inner.margins.extra,
meta.margins,
meta.auto_margins,
between_margin,
panel.margin,
grid.mark.height,
xylab.height,
coords.height,
xlab.show,
xlab.text,
xlab.size,
xlab.color,
xlab.rotation,
xlab.space,
xlab.fontface,
xlab.fontfamily,
xlab.alpha,
xlab.side,
ylab.show,
ylab.text,
ylab.size,
ylab.color,
ylab.rotation,
ylab.space,
ylab.fontface,
ylab.fontfamily,
ylab.alpha,
ylab.side,
panel.type,
panel.wrap.pos,
panel.xtab.pos,
unit,
color.sepia_intensity,
color.saturation,
color_vision_deficiency_sim,
text.fontface,
text.fontfamily,
text.alpha,
component.position,
component.offset,
component.stack_margin,
component.autoscale,
component.resize_as_group,
component.frame_combine,
component.stack,
legend.stack,
chart.stack,
component.equalize,
component.frame,
component.frame.color,
component.frame.alpha,
component.frame.lwd,
component.frame.r,
component.bg,
component.bg.color,
component.bg.alpha,
legend.show,
legend.design,
legend.orientation,
legend.position,
legend.width,
legend.height,
legend.reverse,
legend.na.show,
legend.title.color,
legend.title.size,
legend.title.fontface,
legend.title.fontfamily,
legend.title.alpha,
legend.xlab.color,
legend.xlab.size,
legend.xlab.fontface,
legend.xlab.fontfamily,
legend.xlab.alpha,
legend.ylab.color,
legend.ylab.size,
legend.ylab.fontface,
legend.ylab.fontfamily,
legend.ylab.alpha,
legend.text.color,
legend.text.size,
legend.text.fontface,
legend.text.fontfamily,
legend.text.alpha,
legend.frame,
legend.frame.color,
legend.frame.alpha,
legend.frame.lwd,
legend.frame.r,
legend.bg,
legend.bg.color,
legend.bg.alpha,
legend.only,
legend.absolute_fontsize,
legend.settings.standard.portrait,
legend.settings.standard.landscape,
add_legend.position,
chart.show,
chart.plot.axis.x,
chart.plot.axis.y,
chart.position,
chart.width,
chart.height,
chart.reverse,
chart.na.show,
chart.title.color,
chart.title.size,
chart.title.fontface,
chart.title.fontfamily,
chart.title.alpha,
chart.xlab.color,
chart.xlab.size,
chart.xlab.fontface,
chart.xlab.fontfamily,
chart.xlab.alpha,
chart.ylab.color,
chart.ylab.size,
chart.ylab.fontface,
chart.ylab.fontfamily,
chart.ylab.alpha,
chart.text.color,
chart.text.size,
chart.text.fontface,
chart.text.fontfamily,
chart.text.alpha,
chart.frame,
chart.frame.color,
chart.frame.alpha,
chart.frame.lwd,
chart.frame.r,
chart.bg,
chart.bg.color,
chart.bg.alpha,
chart.object.color,
title.size,
title.color,
title.fontface,
title.fontfamily,
title.alpha,
title.padding,
title.frame,
title.frame.color,
title.frame.alpha,
title.frame.lwd,
title.frame.r,
title.position,
title.width,
credits.size,
credits.color,
credits.fontface,
credits.fontfamily,
credits.alpha,
credits.padding,
credits.position,
credits.width,
credits.height,
compass.north,
compass.type,
compass.text.size,
compass.size,
compass.show.labels,
compass.cardinal.directions,
compass.text.color,
compass.color.dark,
compass.color.light,
compass.lwd,
compass.margins,
compass.position,
inset.position,
logo.height,
logo.margins,
logo.between_margin,
logo.position,
inset_map.height,
inset_map.width,
inset_map.margins,
inset_map.between_margin,
inset_map.position,
inset_map.frame,
inset.height,
inset.width,
inset.margins,
inset.between_margin,
inset.frame,
inset.bg,
inset.bg.color,
inset.bg.alpha,
inset_grob.height,
inset_grob.width,
inset_gg.height,
inset_gg.width,
scalebar.breaks,
scalebar.width,
scalebar.allow_clipping,
scalebar.text.size,
scalebar.text.color,
scalebar.text.fontface,
scalebar.text.fontfamily,
scalebar.color.dark,
scalebar.color.light,
scalebar.lwd,
scalebar.size,
scalebar.margins,
scalebar.position,
grid.show,
grid.labels.pos,
grid.x,
grid.y,
grid.n.x,
grid.n.y,
grid.crs,
grid.col,
grid.lwd,
grid.alpha,
grid.labels.show,
grid.labels.size,
grid.labels.col,
grid.labels.fontface,
grid.labels.fontfamily,
grid.labels.rot,
grid.labels.format,
grid.labels.cardinal,
grid.labels.margin.x,
grid.labels.margin.y,
grid.labels.space.x,
grid.labels.space.y,
grid.labels.inside_frame,
grid.ticks,
grid.lines,
grid.ndiscr,
mouse_coordinates.position,
minimap.server,
minimap.toggle,
minimap.position,
panel.show,
panel.labels,
panel.label.size,
panel.label.color,
panel.label.fontface,
panel.label.fontfamily,
panel.label.alpha,
panel.label.bg,
panel.label.bg.color,
panel.label.bg.alpha,
panel.label.frame,
panel.label.frame.color,
panel.label.frame.alpha,
panel.label.frame.lwd,
panel.label.frame.r,
panel.label.height,
panel.label.rot,
qtm.scalebar,
qtm.minimap,
qtm.mouse_coordinates,
earth_boundary,
earth_boundary.color,
earth_boundary.lwd,
earth_datum,
space.color,
check_and_fix,
basemap.show,
basemap.server,
basemap.alpha,
basemap.zoom,
tiles.show,
tiles.server,
tiles.alpha,
tiles.zoom,
attr.color,
crs_extra,
crs_global,
crs_basemap,
title = NULL,
...
)
Arguments
style |
name of the style |
... |
List of tmap options to be set, or option names (characters) to be returned (see details) |
scale |
Overall scale of the map |
asp |
Aspect ratio of each map. When |
bg |
Draw map background? |
bg.color |
Background color of the map. |
outer.bg |
Draw map background (outside the frame)? |
outer.bg.color |
Background color of map outside the frame. |
frame |
Draw map frame? |
frame.color |
The color of the frame. |
frame.alpha |
The alpha transparency of the frame. |
frame.lwd |
The line width of the frame. See |
frame.r |
The r (radius) of the frame. |
frame.double_line |
The double line of the frame. |
outer.margins |
The margins of the outer space (outside the frame. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inner.margins |
The margins of the inner space (inside the frame). A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inner.margins.extra |
The extra arguments of the margins of the inner space (inside the frame). A list of arguments. |
meta.margins |
The margins of the meta. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
meta.auto_margins |
The auto_margins of the meta. |
between_margin |
Margin between the map. |
panel.margin |
The margin of the panel. |
grid.mark.height |
The height of the mark of the grid. |
xylab.height |
The height of the xylab. |
coords.height |
The height of the coords. |
xlab.show |
The visibility of the xlab. |
xlab.text |
The text of the xlab. |
xlab.size |
The size of the xlab. |
xlab.color |
The color of the xlab. |
xlab.rotation |
The rotation of the xlab. |
xlab.space |
The space of the xlab. In terms of number of text line heights. |
xlab.fontface |
The font face of the xlab. See |
xlab.fontfamily |
The font family of the xlab. See |
xlab.alpha |
The alpha transparency of the xlab. |
xlab.side |
The side of the xlab. |
ylab.show |
The visibility of the ylab. |
ylab.text |
The text of the ylab. |
ylab.size |
The size of the ylab. |
ylab.color |
The color of the ylab. |
ylab.rotation |
The rotation of the ylab. |
ylab.space |
The space of the ylab. In terms of number of text line heights. |
ylab.fontface |
The font face of the ylab. See |
ylab.fontfamily |
The font family of the ylab. See |
ylab.alpha |
The alpha transparency of the ylab. |
ylab.side |
The side of the ylab. |
panel.type |
The type of the panel. |
panel.wrap.pos |
The panel positions for wrapped facets created with |
panel.xtab.pos |
The panel positions for grid facets created with |
unit |
Unit of the coordinate |
color.sepia_intensity |
The sepia_intensity of the color. |
color.saturation |
The saturation of the color. |
color_vision_deficiency_sim |
'Color vision deficiency simulation |
text.fontface |
The font face of the text. See |
text.fontfamily |
The font family of the text. See |
text.alpha |
The alpha transparency of the text. |
component.position |
The position of the component. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
component.offset |
The offset of the component. |
component.stack_margin |
The stack_margin of the component. |
component.autoscale |
The autoscale of the component. |
component.resize_as_group |
The resize_as_group of the component. |
component.frame_combine |
The frame_combine of the component. |
component.stack |
The stack of the component. |
legend.stack |
The stack of the legend. |
chart.stack |
The stack of the chart. |
component.equalize |
The equalize of the component. |
component.frame |
The frame of the component. |
component.frame.color |
The color of the frame of the component. |
component.frame.alpha |
The alpha transparency of the frame of the component. |
component.frame.lwd |
The line width of the frame of the component. See |
component.frame.r |
The r (radius) of the frame of the component. |
component.bg |
The bg of the component. |
component.bg.color |
The color of the bg of the component. |
component.bg.alpha |
The alpha transparency of the bg of the component. |
legend.show |
The visibility of the legend. |
legend.design |
The design of the legend. |
legend.orientation |
The orientation of the legend. |
legend.position |
The position of the legend. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
legend.width |
The width of the legend. |
legend.height |
The height of the legend. |
legend.reverse |
The reverse of the legend. |
legend.na.show |
The visibility of the na of the legend. |
legend.title.color |
The color of the title of the legend. |
legend.title.size |
The size of the title of the legend. |
legend.title.fontface |
The font face of the title of the legend. See |
legend.title.fontfamily |
The font family of the title of the legend. See |
legend.title.alpha |
The alpha transparency of the title of the legend. |
legend.xlab.color |
The color of the xlab of the legend. |
legend.xlab.size |
The size of the xlab of the legend. |
legend.xlab.fontface |
The font face of the xlab of the legend. See |
legend.xlab.fontfamily |
The font family of the xlab of the legend. See |
legend.xlab.alpha |
The alpha transparency of the xlab of the legend. |
legend.ylab.color |
The color of the ylab of the legend. |
legend.ylab.size |
The size of the ylab of the legend. |
legend.ylab.fontface |
The font face of the ylab of the legend. See |
legend.ylab.fontfamily |
The font family of the ylab of the legend. See |
legend.ylab.alpha |
The alpha transparency of the ylab of the legend. |
legend.text.color |
The color of the text of the legend. |
legend.text.size |
The size of the text of the legend. |
legend.text.fontface |
The font face of the text of the legend. See |
legend.text.fontfamily |
The font family of the text of the legend. See |
legend.text.alpha |
The alpha transparency of the text of the legend. |
legend.frame |
The frame of the legend. |
legend.frame.color |
The color of the frame of the legend. |
legend.frame.alpha |
The alpha transparency of the frame of the legend. |
legend.frame.lwd |
The line width of the frame of the legend. See |
legend.frame.r |
The r (radius) of the frame of the legend. |
legend.bg |
The bg of the legend. |
legend.bg.color |
The color of the bg of the legend. |
legend.bg.alpha |
The alpha transparency of the bg of the legend. |
legend.only |
The only of the legend. |
legend.absolute_fontsize |
The absolute fontsize of the legend. So far, only used to calculate legend dimensions |
legend.settings.standard.portrait |
The portrait of the standard of the settings of the legend. |
legend.settings.standard.landscape |
The landscape of the standard of the settings of the legend. |
add_legend.position |
The position of the add_legend. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
chart.show |
The visibility of the chart. |
chart.plot.axis.x |
The x of the axis of the plot of the chart. |
chart.plot.axis.y |
The y of the axis of the plot of the chart. |
chart.position |
The position of the chart. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
chart.width |
The width of the chart. |
chart.height |
The height of the chart. |
chart.reverse |
The reverse of the chart. |
chart.na.show |
The visibility of the na of the chart. |
chart.title.color |
The color of the title of the chart. |
chart.title.size |
The size of the title of the chart. |
chart.title.fontface |
The font face of the title of the chart. See |
chart.title.fontfamily |
The font family of the title of the chart. See |
chart.title.alpha |
The alpha transparency of the title of the chart. |
chart.xlab.color |
The color of the xlab of the chart. |
chart.xlab.size |
The size of the xlab of the chart. |
chart.xlab.fontface |
The font face of the xlab of the chart. See |
chart.xlab.fontfamily |
The font family of the xlab of the chart. See |
chart.xlab.alpha |
The alpha transparency of the xlab of the chart. |
chart.ylab.color |
The color of the ylab of the chart. |
chart.ylab.size |
The size of the ylab of the chart. |
chart.ylab.fontface |
The font face of the ylab of the chart. See |
chart.ylab.fontfamily |
The font family of the ylab of the chart. See |
chart.ylab.alpha |
The alpha transparency of the ylab of the chart. |
chart.text.color |
The color of the text of the chart. |
chart.text.size |
The size of the text of the chart. |
chart.text.fontface |
The font face of the text of the chart. See |
chart.text.fontfamily |
The font family of the text of the chart. See |
chart.text.alpha |
The alpha transparency of the text of the chart. |
chart.frame |
The frame of the chart. |
chart.frame.color |
The color of the frame of the chart. |
chart.frame.alpha |
The alpha transparency of the frame of the chart. |
chart.frame.lwd |
The line width of the frame of the chart. See |
chart.frame.r |
The r (radius) of the frame of the chart. |
chart.bg |
The bg of the chart. |
chart.bg.color |
The color of the bg of the chart. |
chart.bg.alpha |
The alpha transparency of the bg of the chart. |
chart.object.color |
The color of the object of the chart. |
title.size |
The size of the title. |
title.color |
The color of the title. |
title.fontface |
The font face of the title. See |
title.fontfamily |
The font family of the title. See |
title.alpha |
The alpha transparency of the title. |
title.padding |
The padding of the title. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
title.frame |
The frame of the title. |
title.frame.color |
The color of the frame of the title. |
title.frame.alpha |
The alpha transparency of the frame of the title. |
title.frame.lwd |
The line width of the frame of the title. See |
title.frame.r |
The r (radius) of the frame of the title. |
title.position |
The position of the title. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
title.width |
The width of the title. |
credits.size |
The size of the credits. |
credits.color |
The color of the credits. |
credits.fontface |
The font face of the credits. See |
credits.fontfamily |
The font family of the credits. See |
credits.alpha |
The alpha transparency of the credits. |
credits.padding |
The padding of the credits. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
credits.position |
The position of the credits. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
credits.width |
The width of the credits. |
credits.height |
The height of the credits. |
compass.north |
The north of the compass. |
compass.type |
The type of the compass. |
compass.text.size |
The size of the text of the compass. |
compass.size |
The size of the compass. |
compass.show.labels |
The labels of the show of the compass. |
compass.cardinal.directions |
The directions of the cardinal of the compass. |
compass.text.color |
The color of the text of the compass. |
compass.color.dark |
The dark of the color of the compass. |
compass.color.light |
The light of the color of the compass. |
compass.lwd |
The line width of the compass. See |
compass.margins |
The margins of the compass. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
compass.position |
The position of the compass. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset.position |
The position of the inset. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
logo.height |
The height of the logo. |
logo.margins |
The margins of the logo. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
logo.between_margin |
The between_margin of the logo. |
logo.position |
The position of the logo. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset_map.height |
The height of the inset_map. |
inset_map.width |
The width of the inset_map. |
inset_map.margins |
The margins of the inset_map. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inset_map.between_margin |
The between_margin of the inset_map. |
inset_map.position |
The position of the inset_map. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
inset_map.frame |
The frame of the inset_map. |
inset.height |
The height of the inset. |
inset.width |
The width of the inset. |
inset.margins |
The margins of the inset. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
inset.between_margin |
The between_margin of the inset. |
inset.frame |
The frame of the inset. |
inset.bg |
The bg of the inset. |
inset.bg.color |
The color of the bg of the inset. |
inset.bg.alpha |
The alpha transparency of the bg of the inset. |
inset_grob.height |
The height of the inset_grob. |
inset_grob.width |
The width of the inset_grob. |
inset_gg.height |
The height of the inset_gg. |
inset_gg.width |
The width of the inset_gg. |
scalebar.breaks |
See |
scalebar.width |
See |
scalebar.allow_clipping |
See |
scalebar.text.size |
The size of the text of the scalebar. |
scalebar.text.color |
The color of the text of the scalebar. |
scalebar.text.fontface |
The font face of the text of the scalebar. See |
scalebar.text.fontfamily |
The font family of the text of the scalebar. See |
scalebar.color.dark |
The dark of the color of the scalebar. |
scalebar.color.light |
The light of the color of the scalebar. |
scalebar.lwd |
The line width of the scalebar. See |
scalebar.size |
The size of the scalebar. |
scalebar.margins |
The margins of the scalebar. A vector of 4 values: bottom, left, top, right. The unit is the device height (for bottom and top) or width (for left and right). |
scalebar.position |
The position of the scalebar. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
grid.show |
The visibility of the grid. |
grid.labels.pos |
The pos of the labels of the grid. |
grid.x |
The x of the grid. |
grid.y |
The y of the grid. |
grid.n.x |
The x of the n of the grid. |
grid.n.y |
The y of the n of the grid. |
grid.crs |
The coordinate reference system (CRS) of the grid. |
grid.col |
The color of the grid. |
grid.lwd |
The line width of the grid. See |
grid.alpha |
The alpha transparency of the grid. |
grid.labels.show |
The visibility of the labels of the grid. |
grid.labels.size |
The size of the labels of the grid. |
grid.labels.col |
The color of the labels of the grid. |
grid.labels.fontface |
The font face of the labels of the grid. See |
grid.labels.fontfamily |
The font family of the labels of the grid. See |
grid.labels.rot |
The rot of the labels of the grid. |
grid.labels.format |
The format of the labels of the grid. |
grid.labels.cardinal |
The cardinal of the labels of the grid. |
grid.labels.margin.x |
The x of the margin of the labels of the grid. |
grid.labels.margin.y |
The y of the margin of the labels of the grid. |
grid.labels.space.x |
The x of the space of the labels of the grid. |
grid.labels.space.y |
The y of the space of the labels of the grid. |
grid.labels.inside_frame |
The inside_frame of the labels of the grid. |
grid.ticks |
The ticks of the grid. |
grid.lines |
The lines of the grid. |
grid.ndiscr |
The ndiscr of the grid. |
mouse_coordinates.position |
The position of the mouse_coordinates. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
minimap.server |
The server of the minimap. |
minimap.toggle |
The toggle of the minimap. |
minimap.position |
The position of the minimap. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
panel.show |
The visibility of the panel. |
panel.labels |
The labels of the panel. |
panel.label.size |
The size of the label of the panel. |
panel.label.color |
The color of the label of the panel. |
panel.label.fontface |
The font face of the label of the panel. See |
panel.label.fontfamily |
The font family of the label of the panel. See |
panel.label.alpha |
The alpha transparency of the label of the panel. |
panel.label.bg |
The bg of the label of the panel. |
panel.label.bg.color |
The color of the bg of the label of the panel. |
panel.label.bg.alpha |
The alpha transparency of the bg of the label of the panel. |
panel.label.frame |
The frame of the label of the panel. |
panel.label.frame.color |
The color of the frame of the label of the panel. |
panel.label.frame.alpha |
The alpha transparency of the frame of the label of the panel. |
panel.label.frame.lwd |
The line width of the frame of the label of the panel. See |
panel.label.frame.r |
The r (radius) of the frame of the label of the panel. |
panel.label.height |
The height of the label of the panel. |
panel.label.rot |
Rotation angles of the panel labels. Vector of four values that determine the panel label rotation when they are placed left, top, right, and bottom. The default angles are 90, 0, 270 and 0 respectively. Note that the second value is the most common, since labels are by default shown on top (see |
qtm.scalebar |
The scalebar of the qtm. |
qtm.minimap |
The minimap of the qtm. |
qtm.mouse_coordinates |
The mouse_coordinates of the qtm. |
earth_boundary |
The earth boundary |
earth_boundary.color |
The color of the earth_boundary. |
earth_boundary.lwd |
The line width of the earth_boundary. See |
earth_datum |
Earth datum |
space.color |
The color of the space. |
check_and_fix |
Should attempt to fix an invalid shapefile |
basemap.show |
The visibility of the basemap. |
basemap.server |
The server of the basemap. |
basemap.alpha |
The alpha transparency of the basemap. |
basemap.zoom |
The zoom of the basemap. |
tiles.show |
The visibility of the tiles. |
tiles.server |
The server of the tiles. |
tiles.alpha |
The alpha transparency of the tiles. |
tiles.zoom |
The zoom of the tiles. |
attr.color |
The color of the attr. |
crs_extra |
Only used internally (work in progress) |
crs_global |
The used crs for world maps |
crs_basemap |
The crs_basemap of the . |
title |
deprecated See |
See Also
Vignette about layout, vignette about margins and aspect ratio and vignette about options
Examples
tm_shape(World) +
tm_polygons() +
tm_layout(
bg.color = "steelblue",
outer.bg.color = "gold",
frame.lwd = 3,
inner.margins = 0)
tm_shape(World) +
tm_polygons(fill = "HPI") +
tm_style("classic")
tm_shape(World) +
tm_polygons(fill = "HPI") +
tm_style("cobalt")
Map layer: symbols
Description
Map layer that draws symbols Supported visual variables are:
fill
(the fill color), col
(the border color), size
the symbol size,
shape
the symbol shape, lwd
(line width), lty
(line type), fill_alpha
(fill color alpha transparency) and col_alpha
(border color alpha transparency).
Usage
tm_symbols(
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.chart = tm_chart_none(),
size.free = NA,
fill = tm_const(),
fill.scale = tm_scale(),
fill.legend = tm_legend(),
fill.chart = tm_chart_none(),
fill.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
shape = tm_const(),
shape.scale = tm_scale(),
shape.legend = tm_legend(),
shape.chart = tm_chart_none(),
shape.free = NA,
lwd = tm_const(),
lwd.scale = tm_scale(),
lwd.legend = tm_legend(),
lwd.chart = tm_chart_none(),
lwd.free = NA,
lty = tm_const(),
lty.scale = tm_scale(),
lty.legend = tm_legend(),
lty.chart = tm_chart_none(),
lty.free = NA,
fill_alpha = tm_const(),
fill_alpha.scale = tm_scale(),
fill_alpha.legend = tm_legend(),
fill_alpha.chart = tm_chart_none(),
fill_alpha.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
plot.order = tm_plot_order("size"),
zindex = NA,
group = NA,
group.control = "check",
popup.vars = NA,
popup.format = list(),
hover = NA,
id = "",
options = opt_tm_symbols(),
...
)
tm_dots(
fill = tm_const(),
fill.scale = tm_scale(),
fill.legend = tm_legend(),
fill.free = NA,
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.free = NA,
lwd = tm_const(),
lwd.scale = tm_scale(),
lwd.legend = tm_legend(),
lwd.free = NA,
lty = tm_const(),
lty.scale = tm_scale(),
lty.legend = tm_legend(),
lty.free = NA,
fill_alpha = tm_const(),
fill_alpha.scale = tm_scale(),
fill_alpha.legend = tm_legend(),
fill_alpha.free = NA,
plot.order = tm_plot_order("DATA"),
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_dots(),
...
)
tm_bubbles(
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.free = NA,
fill = tm_const(),
fill.scale = tm_scale(),
fill.legend = tm_legend(),
fill.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.free = NA,
lwd = tm_const(),
lwd.scale = tm_scale(),
lwd.legend = tm_legend(),
lwd.free = NA,
lty = tm_const(),
lty.scale = tm_scale(),
lty.legend = tm_legend(),
lty.free = NA,
fill_alpha = tm_const(),
fill_alpha.scale = tm_scale(),
fill_alpha.legend = tm_legend(),
fill_alpha.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.free = NA,
plot.order = tm_plot_order("size"),
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_bubbles(),
...
)
tm_squares(
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.free = NA,
fill = tm_const(),
fill.scale = tm_scale(),
fill.legend = tm_legend(),
fill.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.free = NA,
lwd = tm_const(),
lwd.scale = tm_scale(),
lwd.legend = tm_legend(),
lwd.free = NA,
lty = tm_const(),
lty.scale = tm_scale(),
lty.legend = tm_legend(),
lty.free = NA,
fill_alpha = tm_const(),
fill_alpha.scale = tm_scale(),
fill_alpha.legend = tm_legend(),
fill_alpha.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.free = NA,
plot.order = tm_plot_order("size"),
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_squares(),
...
)
tm_markers(
text = tm_const(),
text.scale = tm_scale(),
text.legend = tm_legend(),
text.chart = tm_chart_none(),
text.free = NA,
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.chart = tm_chart_none(),
size.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
fontface = tm_const(),
fontface.scale = tm_scale(),
fontface.legend = tm_legend(),
fontface.chart = tm_chart_none(),
fontface.free = NA,
fontfamily = "",
bgcol = tm_const(),
bgcol.scale = tm_scale(),
bgcol.legend = tm_legend(),
bgcol.chart = tm_chart_none(),
bgcol.free = NA,
bgcol_alpha = tm_const(),
bgcol_alpha.scale = tm_scale(),
bgcol_alpha.legend = tm_legend(),
bgcol_alpha.chart = tm_chart_none(),
bgcol_alpha.free = NA,
xmod = 0,
xmod.scale = tm_scale(),
xmod.legend = tm_legend_hide(),
xmod.chart = tm_chart_none(),
xmod.free = NA,
ymod = 0,
ymod.scale = tm_scale(),
ymod.legend = tm_legend_hide(),
ymod.chart = tm_chart_none(),
ymod.free = NA,
angle = 0,
angle.scale = tm_scale(),
angle.legend = tm_legend_hide(),
angle.chart = tm_chart_none(),
angle.free = NA,
plot.order = tm_plot_order("AREA", reverse = FALSE, na.order = "bottom"),
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_markers(),
...
)
opt_tm_markers(
markers_on_top_of_text = FALSE,
points_only = "ifany",
point_per = "feature",
on_surface = FALSE,
shadow = FALSE,
shadow.offset.x = 0.1,
shadow.offset.y = 0.1,
just = "center",
along_lines = TRUE,
bg.padding = 0.4,
clustering = TRUE,
point.label = TRUE,
point.label.gap = 0.4,
point.label.method = "SANN",
remove_overlap = FALSE,
dots.just = NA,
dots.icon.scale = 3,
dots.grob.dim = c(width = 48, height = 48, render.width = 256, render.height = 256)
)
opt_tm_symbols(
points_only = "ifany",
point_per = "feature",
on_surface = FALSE,
icon.scale = 3,
just = NA,
grob.dim = c(width = 48, height = 48, render.width = 256, render.height = 256)
)
opt_tm_dots(
points_only = "ifany",
point_per = "feature",
on_surface = FALSE,
icon.scale = 3,
just = NA,
grob.dim = c(width = 48, height = 48, render.width = 256, render.height = 256)
)
opt_tm_bubbles(
points_only = "ifany",
point_per = "feature",
on_surface = FALSE,
icon.scale = 3,
just = NA,
grob.dim = c(width = 48, height = 48, render.width = 256, render.height = 256)
)
opt_tm_squares(
points_only = "ifany",
point_per = "feature",
on_surface = FALSE,
icon.scale = 3,
just = NA,
grob.dim = c(width = 48, height = 48, render.width = 256, render.height = 256)
)
Arguments
size , size.scale , size.legend , size.chart , size.free |
Visual variable that determines the size. See details. |
fill , fill.scale , fill.legend , fill.chart , fill.free |
Visual variable that determines the fill color. See details. |
col , col.scale , col.legend , col.chart , col.free |
Visual variable that determines the color. See details. |
shape , shape.scale , shape.legend , shape.chart , shape.free |
Visual variable that determines the shape. See details. |
lwd , lwd.scale , lwd.legend , lwd.chart , lwd.free |
Visual variable that determines the line width. See details. |
lty , lty.scale , lty.legend , lty.chart , lty.free |
Visual variable that determines the line type. See details. |
fill_alpha , fill_alpha.scale , fill_alpha.legend , fill_alpha.chart , fill_alpha.free |
Visual variable that determines the fill color transparency. See details. the fill color alpha transparency See details. |
col_alpha , col_alpha.scale , col_alpha.legend , col_alpha.chart , col_alpha.free |
Visual variable that determines the color transparency. See details. |
plot.order |
Specification in which order the spatial features are drawn.
See |
zindex |
Map layers are drawn on top of each other. The |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how layer groups
can be switched on and off. Options: |
popup.vars |
names of data variables that are shown in the popups
in |
popup.format |
list of formatting options for the popup values.
See the argument |
hover |
name of the data variable that specifies the hover labels (view mode only). Set to |
id |
name of the data variable that specifies the indices of the spatial
features. Only used for |
options |
options passed on to the corresponding |
... |
to catch deprecated arguments from version < 4.0 |
text , text.scale , text.legend , text.chart , text.free |
Visual variable that determines the text. See details. |
fontface , fontface.scale , fontface.legend , fontface.chart , fontface.free |
Visual variable that determines the font face. See details. |
fontfamily |
The font family. See gpar() for details. |
bgcol , bgcol.scale , bgcol.legend , bgcol.chart , bgcol.free |
Visual variable that determines the background color. See Details. |
bgcol_alpha , bgcol_alpha.scale , bgcol_alpha.legend , bgcol_alpha.chart , bgcol_alpha.free |
Visual variable that determines the background color transparency. See Details. |
xmod , xmod.scale , xmod.legend , xmod.chart , xmod.free |
Transformation variable that determines the x offset. See details. |
ymod , ymod.scale , ymod.legend , ymod.chart , ymod.free |
Transformation variable that determines the y offset. See details. the text. See details. |
angle , angle.scale , angle.legend , angle.chart , angle.free |
Rotation angle |
markers_on_top_of_text |
should markers be plot on top of the text (by default |
points_only |
should only point geometries of the shape object (defined in |
point_per |
specification of how spatial points are mapped when the geometry is a multi line or a multi polygon. One of |
on_surface |
In case of polygons, centroids are computed. Should the points be on the surface? If |
shadow |
Shadow behind the text. Logical or color. |
shadow.offset.x , shadow.offset.y |
Shadow offset in line heights |
just |
justification of the text relative to the point coordinates. Either one of the following values: |
along_lines |
logical that determines whether labels are rotated along the spatial lines. Only applicable if a spatial lines shape is used. |
bg.padding |
The padding of the background in terms of line heights. |
clustering |
value that determines whether the text labels are clustered in |
point.label |
logical that determines whether the labels are placed automatically. By default |
point.label.gap |
numeric that determines the gap between the point and label |
point.label.method |
the optimization method, either |
remove_overlap |
logical that determines whether the overlapping labels are removed |
dots.just |
justification of the text relative to the point coordinates. Either one of the following values: |
dots.icon.scale |
scaling number that determines how large the icons (or grobs) are in plot mode in comparison to proportional symbols (such as bubbles). In view mode, the size is determined by the icon specification (see |
dots.grob.dim |
vector of four values that determine how grob objects (see details) are shown in view mode. The first and second value are the width and height of the displayed icon. The third and fourth value are the width and height of the rendered png image that is used for the icon. Generally, the third and fourth value should be large enough to render a ggplot2 graphic successfully. Only needed for the view mode. |
icon.scale |
scaling number that determines how large the icons (or grobs) are in plot mode in comparison to proportional symbols (such as bubbles). For view mode, use the argument |
grob.dim |
vector of four values that determine how grob objects (see details) are shown in view mode. The first and second value are the width and height of the displayed icon. The third and fourth value are the width and height of the rendered png image that is used for the icon. Generally, the third and fourth value should be large enough to render a ggplot2 graphic successfully. Only needed for the view mode. |
Details
A symbol shape specification is one of the following three options.
A numeric value that specifies the plotting character of the symbol. See parameter
pch
ofpoints
and the last example to create a plot with all options. Note that this is not supported for the"view" mode.
A
grob
object, which can be a ggplot2 plot object created withggplotGrob
. To specify multiple shapes, a list of grob objects is required. See example of a proportional symbol map with ggplot2 plots.An icon specification, which can be created with
tmap_icons
.
To specify multiple shapes (needed for the shapes
argument), a vector or list of these shape specification is required. The shape specification options can also be mixed. For the shapes
argument, it is possible to use a named vector or list, where the names correspond to the value of the variable specified by the shape
argument.
For small multiples, a list of these shape specification(s) should be provided.
See Also
Bubble map example and terrain map example
Examples
########################
## plot symbol shapes
########################
# create grid of 25 points in the Atlantic
atlantic_grid = cbind(expand.grid(x = -51:-47, y = 20:24), id = seq_len(25))
x = sf::st_as_sf(atlantic_grid, coords = c("x", "y"), crs = 4326)
tm_shape(x, bbox = tmaptools::bb(x, ext = 1.2)) +
tm_symbols(shape = "id",
size = 2,
lwd = 2,
fill = "orange",
col = "black",
shape.scale = tm_scale_asis()) +
tm_text("id", ymod = -2)
Map layer: text
Description
Map layer that draws symbols Supported visual variables are: text
(the text itself) col
(color), size
(font size), and fontface
(font face).
Usage
tm_text(
text = tm_const(),
text.scale = tm_scale(),
text.legend = tm_legend(),
text.chart = tm_chart_none(),
text.free = NA,
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.chart = tm_chart_none(),
size.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
fontface = tm_const(),
fontface.scale = tm_scale(),
fontface.legend = tm_legend(),
fontface.chart = tm_chart_none(),
fontface.free = NA,
fontfamily = NA,
bgcol = tm_const(),
bgcol.scale = tm_scale(),
bgcol.legend = tm_legend(),
bgcol.chart = tm_chart_none(),
bgcol.free = NA,
bgcol_alpha = tm_const(),
bgcol_alpha.scale = tm_scale(),
bgcol_alpha.legend = tm_legend(),
bgcol_alpha.chart = tm_chart_none(),
bgcol_alpha.free = NA,
xmod = 0,
xmod.scale = tm_scale(),
xmod.legend = tm_legend_hide(),
xmod.chart = tm_chart_none(),
xmod.free = NA,
ymod = 0,
ymod.scale = tm_scale(),
ymod.legend = tm_legend_hide(),
ymod.chart = tm_chart_none(),
ymod.free = NA,
angle = 0,
angle.scale = tm_scale(),
angle.legend = tm_legend_hide(),
angle.chart = tm_chart_none(),
angle.free = NA,
plot.order = tm_plot_order("size", reverse = FALSE),
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_text(),
...
)
tm_labels(
text = tm_const(),
text.scale = tm_scale(),
text.legend = tm_legend(),
text.chart = tm_chart_none(),
text.free = NA,
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.chart = tm_chart_none(),
size.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
fontface = tm_const(),
fontface.scale = tm_scale(),
fontface.legend = tm_legend(),
fontface.chart = tm_chart_none(),
fontface.free = NA,
fontfamily = "",
bgcol = tm_const(),
bgcol.scale = tm_scale(),
bgcol.legend = tm_legend(),
bgcol.chart = tm_chart_none(),
bgcol.free = NA,
bgcol_alpha = tm_const(),
bgcol_alpha.scale = tm_scale(),
bgcol_alpha.legend = tm_legend(),
bgcol_alpha.chart = tm_chart_none(),
bgcol_alpha.free = NA,
xmod = 0,
xmod.scale = tm_scale(),
xmod.legend = tm_legend_hide(),
xmod.chart = tm_chart_none(),
xmod.free = NA,
ymod = 0,
ymod.scale = tm_scale(),
ymod.legend = tm_legend_hide(),
ymod.chart = tm_chart_none(),
ymod.free = NA,
angle = 0,
angle.scale = tm_scale(),
angle.legend = tm_legend_hide(),
angle.chart = tm_chart_none(),
angle.free = NA,
plot.order = tm_plot_order("AREA", reverse = FALSE, na.order = "bottom"),
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_labels(),
...
)
tm_labels_highlighted(
text = tm_const(),
text.scale = tm_scale(),
text.legend = tm_legend(),
text.chart = tm_chart_none(),
text.free = NA,
size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.chart = tm_chart_none(),
size.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.chart = tm_chart_none(),
col.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.chart = tm_chart_none(),
col_alpha.free = NA,
fontface = tm_const(),
fontface.scale = tm_scale(),
fontface.legend = tm_legend(),
fontface.chart = tm_chart_none(),
fontface.free = NA,
fontfamily = "",
bgcol = tm_const(),
bgcol.scale = tm_scale(),
bgcol.legend = tm_legend(),
bgcol.chart = tm_chart_none(),
bgcol.free = NA,
bgcol_alpha = tm_const(),
bgcol_alpha.scale = tm_scale(),
bgcol_alpha.legend = tm_legend(),
bgcol_alpha.chart = tm_chart_none(),
bgcol_alpha.free = NA,
xmod = 0,
xmod.scale = tm_scale(),
xmod.legend = tm_legend_hide(),
xmod.chart = tm_chart_none(),
xmod.free = NA,
ymod = 0,
ymod.scale = tm_scale(),
ymod.legend = tm_legend_hide(),
ymod.chart = tm_chart_none(),
ymod.free = NA,
angle = 0,
angle.scale = tm_scale(),
angle.legend = tm_legend_hide(),
angle.chart = tm_chart_none(),
angle.free = NA,
plot.order = tm_plot_order("AREA", reverse = FALSE, na.order = "bottom"),
zindex = NA,
group = NA,
group.control = "check",
options = opt_tm_labels(),
...
)
opt_tm_text(
points_only = "ifany",
point_per = "feature",
on_surface = FALSE,
shadow = FALSE,
shadow.offset.x = 0.1,
shadow.offset.y = 0.1,
just = "center",
along_lines = FALSE,
bg.padding = 0.4,
clustering = FALSE,
point.label = FALSE,
point.label.gap = 0,
point.label.method = "SANN",
remove_overlap = FALSE
)
opt_tm_labels(
points_only = "ifany",
point_per = "feature",
on_surface = FALSE,
shadow = FALSE,
shadow.offset.x = 0.1,
shadow.offset.y = 0.1,
just = "center",
along_lines = TRUE,
bg.padding = 0.4,
clustering = FALSE,
point.label = NA,
point.label.gap = 0.4,
point.label.method = "SANN",
remove_overlap = FALSE
)
Arguments
text , text.scale , text.legend , text.chart , text.free |
Visual variable that determines the text. See details. |
size , size.scale , size.legend , size.chart , size.free |
Visual variable that determines the size. See details. |
col , col.scale , col.legend , col.chart , col.free |
Visual variable that determines the color. See details. |
col_alpha , col_alpha.scale , col_alpha.legend , col_alpha.chart , col_alpha.free |
Visual variable that determines the color transparency. See details. |
fontface , fontface.scale , fontface.legend , fontface.chart , fontface.free |
Visual variable that determines the font face. See details. |
fontfamily |
The font family. See gpar() for details. |
bgcol , bgcol.scale , bgcol.legend , bgcol.chart , bgcol.free |
Visual variable that determines the background color. See Details. |
bgcol_alpha , bgcol_alpha.scale , bgcol_alpha.legend , bgcol_alpha.chart , bgcol_alpha.free |
Visual variable that determines the background color transparency. See Details. |
xmod , xmod.scale , xmod.legend , xmod.chart , xmod.free |
Transformation variable that determines the x offset. See details. |
ymod , ymod.scale , ymod.legend , ymod.chart , ymod.free |
Transformation variable that determines the y offset. See details. the text. See details. |
angle , angle.scale , angle.legend , angle.chart , angle.free |
Rotation angle |
plot.order |
Specification in which order the spatial features are drawn.
See |
zindex |
Map layers are drawn on top of each other. The |
group |
Name of the group to which this layer belongs. This is only
relevant in view mode, where layer groups can be switched (see |
group.control |
In view mode, the group control determines how layer groups
can be switched on and off. Options: |
options |
options passed on to the corresponding |
... |
to catch deprecated arguments from version < 4.0 |
points_only |
should only point geometries of the shape object (defined in |
point_per |
specification of how spatial points are mapped when the geometry is a multi line or a multi polygon. One of |
on_surface |
In case of polygons, centroids are computed. Should the points be on the surface? If |
shadow |
Shadow behind the text. Logical or color. |
shadow.offset.x , shadow.offset.y |
Shadow offset in line heights |
just |
justification of the text relative to the point coordinates. Either one of the following values: |
along_lines |
logical that determines whether labels are rotated along the spatial lines. Only applicable if a spatial lines shape is used. |
bg.padding |
The padding of the background in terms of line heights. |
clustering |
value that determines whether the text labels are clustered in |
point.label |
logical that determines whether the labels are placed automatically. By default |
point.label.gap |
numeric that determines the gap between the point and label |
point.label.method |
the optimization method, either |
remove_overlap |
logical that determines whether the overlapping labels are removed |
Details
The visual variable arguments (e.g. col
) can be specified with either a data
variable name (e.g., a spatial vector attribute or a raster layer of the object
specified in tm_shape()
), or with a visual value (for col
, a color is expected).
See vignette about visual variables.
Multiple values can be specified: in that case facets are created.
These facets can be combined with other faceting data variables, specified with tm_facets()
.
See vignette about facets.
The
*.scale
arguments determine the used scale to map the data values to visual variable values. These can be specified with one of the availabletm_scale_*()
functions. The default is specified by the tmap option (tm_options()
)scales.var
. See vignette about scales.The
*.legend
arguments determine the used legend, specified withtm_legend()
. The default legend and its settings are determined by the tmap options (tm_options()
)legend.
. See vignette about legends.The
*.chart
arguments specify additional charts, specified withtm_chart_
, e.g.tm_chart_histogram()
. See vignette about charts.The
*.free
arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (seetm_facets()
). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid (tm_facets_grid()
). For instance,col.free = c(TRUE, FALSE, FALSE)
means that for the visual variablecol
, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks (tm_facets_wrap()
andtm_facets_stack()
) there is only one facet dimension, so the*.free
argument requires only one logical value.
See Also
Examples
tm_shape(World, bbox = World) +
tm_text("name", size="pop_est", col="continent",
col.scale = tm_scale_categorical(values = "seaborn.dark"),
col.legend = tm_legend_hide(),
size.scale = tm_scale_continuous(values.scale = 4),
size.legend = tm_legend_hide())
metro$upside_down = ifelse(sf::st_coordinates(metro)[,2] < 0, 180, 0)
tm_shape(metro) +
tm_text(text = "name", size = "pop2020",
angle = "upside_down", size.legend = tm_legend_hide(),
col = "upside_down",
col.scale = tm_scale_categorical(values = c("#9900BB", "#228822")),
col.legend = tm_legend_hide()) +
tm_title_out("Which Hemisphere?", position = tm_pos_out("center", "top", pos.v = "bottom"))
Map component: title
Description
Map component that adds a title
Usage
tm_title(
text,
size,
color,
padding,
fontface,
fontfamily,
alpha,
stack,
just,
frame,
frame.color,
frame.alpha,
frame.lwd,
frame.r,
bg,
bg.color,
bg.alpha,
position,
group_id,
width,
height,
z
)
tm_title_in(text, ..., position = tm_pos_in("left", "top"))
tm_title_out(text, ..., position = tm_pos_out("center", "top"))
Arguments
text |
text |
size |
font size |
color |
font color |
padding |
padding |
fontface |
font face, bold, italic |
fontfamily |
font family |
alpha |
alpha transparency of the text |
stack |
stack with other map components, either |
just |
just |
frame |
frame should a frame be drawn? |
frame.color |
frame color |
frame.alpha |
frame alpha transparancy |
frame.lwd |
frame line width |
frame.r |
Radius of the rounded frame corners. 0 means no rounding. |
bg |
Show background? |
bg.color |
Background color |
bg.alpha |
Background transparency |
position |
The position specification of the component: an object created with |
group_id |
Component group id name. All components (e.g. legends, titles, etc) with the same |
width , height |
width and height of the component. |
z |
z index, e.g. the place of the component relative to the other componets |
... |
passed on to |
See Also
tmap function to specify variables
Description
tmap function to specify all variables in the shape object
Usage
tm_vars(
x = NA,
dimvalues = NULL,
n = NA,
multivariate = FALSE,
animate = FALSE
)
Arguments
x |
variable names, variable indices, or a dimension name |
dimvalues |
dimension values |
n |
if specified the first |
multivariate |
in case multiple variables are specified, should they serve as facets (FALSE) or as a multivariate visual variable? |
animate |
should the variable(s) be animated? (experimental) |
View mode options
Description
View mode options. These options are specific to the view mode.
Usage
tm_view(
use_browser,
use_WebGL,
control.position,
control.bases,
control.overlays,
control.collapse,
set_bounds,
set_view,
set_zoom_limits,
use_circle_markers,
leaflet.options,
...
)
Arguments
use_browser |
If |
use_WebGL |
use webGL for points, lines, and polygons. For large spatial objects, this is much faster than the standard leaflet layer functions. However, it can not always be used for two reasons. First, the number of visual variables are limited; only fill, size, and color (for lines) are supported. Second, projected CRS's are not supported. Furthermore, it has the drawback that polygon borders are not as sharp. By default only |
control.position |
The position of the control. A tm_pos object, or a shortcut of two values: horizontal (left, center, right) and vertical (top, center, bottom). See tm_pos for details |
control.bases |
base layers |
control.overlays |
overlay layers |
control.collapse |
Should the box be collapsed or expanded? |
set_bounds |
logical that determines whether maximum bounds are set, or a bounding box. Not applicable in plot mode. In view mode, this is passed on to setMaxBounds() |
set_view |
numeric vector that determines the view.
Either a vector of three: |
set_zoom_limits |
numeric vector of two that set the minimum and maximum zoom levels (see tileOptions()). |
use_circle_markers |
If |
leaflet.options |
options passed on to leafletOptions() |
... |
to catch deprecated arguments |
See Also
Map: x and y labels
Description
The x and y labels for maps
Usage
tm_xlab(text, size, color, rotation, space, fontface, fontfamily, alpha, side)
tm_ylab(text, size, color, rotation, space, fontface, fontfamily, alpha, side)
Arguments
text |
text of the title |
size |
font size of the title |
color |
color |
rotation |
rotation in degrees |
space |
space between label and map in number of line heights |
fontface |
font face |
fontfamily |
font family |
alpha |
alpha transparency of the text |
side |
side: |
Stacking of tmap elements
Description
The plus operator allows you to stack tmap elements (functions with a prefix tm_
)
Usage
## S3 method for class 'tmap'
e1 + e2
Arguments
e1 |
first tmap element |
e2 |
second tmap element |
Internal tmap function to add a default value for the layer functions
Description
Internal tmap function to add a default value for the layer functions
Usage
tmapAddLayerOptions(option, id, value)
Arguments
option |
one of: |
id |
name of the visual variable with layer, in the format |
value |
value |
Internal method that extracts meta data from shape objects
Description
Internal method that extracts meta data from shape objects
Usage
tmapGetShapeMeta1(shp, o)
Arguments
shp |
the shape object |
o |
the list of options |
Internal method that extracts more meta data from shape objects
Description
Internal method that extracts meta data from shape objects
Usage
tmapGetShapeMeta2(shp, smeta, o)
Arguments
shp |
the shape |
smeta |
meta (from |
o |
the list of options |
Internal method for submitting a new mode
Description
Internal method for submitting a new mode
Usage
tmapMode(id, name, ...)
Arguments
id |
id of the mode: please use lowercase and one-word. This will be used with |
name |
name of the mode: please use title case. This will be used to recognize internal functions, e.g. |
... |
mode specific options |
Internal method that processed shape objects
Description
Internal method that processed shape objects
Usage
tmapShape(shp, is.main, crs, bbox, unit, filter, shp_name, smeta, o, tmf)
Arguments
shp |
shp |
is.main |
is.main |
crs |
crs |
bbox |
Bounding box |
unit |
unit |
filter |
filter |
shp_name |
shp_name |
smeta |
smeta |
o |
o |
tmf |
tmf |
Internal method that split shape objects
Description
Internal method that split shape objects. So far, only used to split stars object (from dimension to attributes)
Usage
tmapSplitShp(shp, split_stars_dim, smeta)
Arguments
shp |
shape |
split_stars_dim |
name of the dimension to split ( |
Internal method that subsets data from shape objects
Description
Internal method that subsets data from shape objects
Usage
tmapSubsetShp(shp, vars)
Arguments
shp |
shape |
vars |
a vector of variable names |
Create animation
Description
Create a gif animation or video from a tmap plot.
Usage
tmap_animation(
tm,
filename = NULL,
width = NA,
height = NA,
dpi = NA,
delay = 40,
fps = NA,
loop = TRUE,
outer.margins = NA,
asp = NULL,
scale = NA,
restart.delay = NULL,
...
)
Arguments
tm |
tmap or a list of tmap objects. If |
filename |
filename. If omitted (default), the animation will be shown
in the viewer or browser. If specified, it should be a gif file or a video
file (i.e. mp4). The package |
width , height |
Dimensions of the animation file (in pixels).
Required when |
dpi |
dots per inch. By default 100, but this can be set with the option
|
delay |
delay time between images (in 1/100th of a second). See also |
fps |
frames per second, calculated as |
loop |
logical that determined whether the animation is looped, or an integer value that determines how many times the animation is looped. |
outer.margins |
(passed on to |
asp |
(passed on to |
scale |
(passed on to |
restart.delay |
not used anymore. |
... |
arguments passed on to |
Note
Not only tmap plots are supported, but any series of R plots.
Examples
## Not run:
data(NLD_prov)
m1 <- tm_shape(NLD_prov) +
tm_polygons("yellow") +
tm_facets(along = "name")
tmap_animation(m1, delay=40)
data(World, metro)
m2 <- tm_shape(World, projection = "+proj=eck4", simplify = 0.5) +
tm_fill() +
tm_shape(metro) +
tm_bubbles(size = paste0("pop", seq(1970, 2030, by=10)),
col = "purple",
border.col = "black", border.alpha = .5,
scale = 2) +
tm_facets(free.scales.symbol.size = FALSE, nrow=1,ncol=1) +
tm_format("World")
tmap_animation(m2, delay=100, outer.margins = 0)
m3 <- lapply(seq(50, 85, by = 5), function(age) {
World$at_most <- World$life_exp <= age
World_sel <- World[which((World$life_exp <= age) & (World$life_exp > (age - 5))), ]
tm_shape(World) +
tm_polygons("at_most", palette = c("gray95", "gold"), legend.show = FALSE) +
tm_shape(World_sel) +
tm_text("name", size = "AREA", root = 5, remove_overlap = TRUE) +
tm_layout(main.title = paste0("Life expectency at most ", age), frame = FALSE)
})
tmap_animation(m3, width = 1200, height = 600, delay = 100)
m4 <- tm_shape(World) +
tm_polygons() +
tm_shape(metro) +
tm_bubbles(col = "red") +
tm_text("name", ymod = -1) +
tm_facets(by = "name", free.coords = FALSE, nrow = 1, ncol = 1) +
tm_layout(panel.show = FALSE, frame = FALSE)
tmap_animation(m4, filename = "World_cities.mp4",
width=1200, height = 600, fps = 2, outer.margins = 0)
## End(Not run)
Arrange small multiples in grid layout
Description
Arrange small multiples in a grid layout. Normally, small multiples are created
by specifying multiple variables for one aesthetic or by specifying the by argument
(see tm_facets()
). This function can be used to arrange custom small multiples in a grid layout.
Usage
tmap_arrange(
...,
ncol = NA,
nrow = NA,
widths = NA,
heights = NA,
sync = FALSE,
asp = 0,
outer.margins = 0.02
)
## S3 method for class 'tmap_arrange'
knit_print(x, ..., options = NULL)
## S3 method for class 'tmap_arrange'
print(x, knit = FALSE, ..., options = NULL)
Arguments
... |
|
ncol |
number of columns |
nrow |
number of rows |
widths |
vector of column widths. It should add up to 1 and the length
should be equal to |
heights |
vector of row heights. It should add up to 1 and the length
should be equal to |
sync |
logical. Should the navigation in view mode (zooming and panning)
be synchronized? By default |
asp |
aspect ratio. The aspect ratio of each map. Normally, this is
controlled by the |
outer.margins |
outer.margins, numeric vector four or a single value.
If defines the outer margins for each multiple. If will overwrite the
|
x |
a |
options |
options passed on to |
knit |
should |
Details
The global option tmap.limits
controls the limit of the number of facets that are plotted.
By default, tmap_options(tmap.limits = c(facets.view=4, facets.plot=64))
.
The maximum number of interactive facets is set to four since otherwise it may become very slow.
Examples
tm1 = tm_shape(World) + tm_polygons("HPI")
tm2 = tm_shape(metro) + tm_bubbles(size = "pop2020")
tmap_arrange(tm1, tm2)
Set the design mode
Description
When the so-called "design mode" is enabled, inner and outer margins,
legend position, and aspect ratio are shown explicitly in plot mode.
Also, information about aspect ratios is printed in the console.
This function sets the global option tmap.design.mode
.
It can be used as toggle function without arguments.
Usage
tmap_design_mode(design.mode)
Arguments
design.mode |
Logical value that determines the design mode. If omitted then the design mode is toggled. |
See Also
Set the development mode
Description
When the so-called "development mode" is enabled, helpful messages and timings are printed in the console
Usage
tmap_devel_mode(devel.mode)
Arguments
devel.mode |
logical value that determines the development mode. If omitted then the development mode is toggled. |
Deprecated: format
Description
In tmap < 4.0 it was possible to set shape-specific options, such as margins and legend position. However, this has become superfluous because in tmap > 4.0 legends are by default placed outside the map area. If needed, a shape-specific set of options can be stored as a style with tmap_options_save.
Usage
tmap_format(format)
tmap_format_add(..., name)
tm_format(format, ...)
Arguments
format |
Name of the format |
... |
not used |
name |
Name of the format |
Specify icons
Description
Specifies icons from a png images, which can be used as markers in thematic maps.
The function marker_icon()
is the specification of the default marker.
Usage
tmap_icons(
file,
names = NULL,
width = 48,
height = 48,
keep.asp = TRUE,
just = c("center", "center"),
merge = NA,
as.local = TRUE,
...
)
marker_icon()
Arguments
file |
character value/vector containing the file path(s) or url(s). |
names |
names to be given to the icons. Useful when icons are assigned to factor levels. |
width |
width of the icon. If |
height |
height of the icon. If |
keep.asp |
keep the aspect ratio of the png image. If |
just |
justification of the icons relative to the point coordinates.
The first value specifies horizontal and the second value vertical justification.
Possible values are: |
merge |
merge icons to one icon list (see return value)? If |
as.local |
if the |
... |
arguments passed on to |
Value
icon data (see leaflet::icons()
)
See Also
Retrieve the last map to be modified or created
Description
Retrieve the last map to be modified or created. Works in the same way
as ggplot2::last_plot()
, although there is a difference:
tmap_last()
returns the last call instead of the stacked tmap-element
s.
Usage
tmap_last()
Value
call
See Also
Export tmap to the format of the used graphics mode
Description
Usage
tmap_leaflet(x, show = FALSE, ...)
tmap_grob(x, asp = NA, scale = 1, show = FALSE, ...)
Arguments
x |
a tmap object. |
show |
show the map? |
... |
Arguments passed on to
|
asp , scale |
the desired aspect ratio and scale of the map. Only applicable for |
Value
-
tmap_grob()
returns agrob
object ("plot"
mode) -
tmap_leaflet()
aleaflet
object ("view"
mode). In case small multiples are shown, a list is returned.
Examples
map = tm_shape(World) + tm_polygons()
tmap_leaflet(map, show = TRUE)
Set tmap mode to static plotting or interactive viewing
Description
-
tmap_mode()
informs of the current mode (if called without argument). -
ttm()
toggles between the most recent two modes. -
ttmp()
same asttm()
and callstmap_last()
to display the last map in the new mode. -
rtm()
rotate between between all modes -
rtmp()
same asrtm()
and callstmap_last()
to display the last map in the new mode.
Set tmap mode to static plotting or interactive viewing.
The global option tmap.mode
determines the whether thematic maps are plot
in the graphics device, or shown as an interactive leaflet map (see also tmap_options()
.
The function tmap_mode()
is a wrapper to set this global option.
The convenient function ttm()
, which stands for toggle thematic map,
is a toggle switch between the two modes. The function ttmp()
stands for
toggle thematic map and print last map: it does the same as ttm()
followed
by tmap_last()
; in order words, it shows the last map in the other mode.
It is recommended to use tmap_mode()
in scripts and ttm()
/ttmp()
in the console.
Usage
tmap_mode(mode = NULL)
ttm()
rtm()
ttmp()
rtmp()
Arguments
mode |
One of |
Value
-
tmap_mode()
returns the current tmap mode invisibly (when called without argument). Otherwise, returns the previous mode. -
ttm()
switches mode and returns previous tmap mode invisibly. The previous tmap mode before switching.
mode = "plot"
Thematic maps are shown in the graphics device.
This is the default mode, and supports all tmap's features,
such as small multiples (see tm_facets()
) and extensive layout settings (see tm_layout()
).
It is recommended to use tmap_save()
for saving static maps.
mode = "view"
Thematic maps are viewed interactively in the web browser or RStudio's Viewer pane.
Maps are fully interactive with tiles from OpenStreetMap or other map providers
(see tm_tiles()
). See also tm_view()
for options related to the "view"
mode.
This mode generates a leaflet::leaflet()
widget, which can also be directly
obtained with tmap_leaflet()
.
With R Markdown, it is possible to publish it to an HTML page.
However, there are a couple of constraints in comparison to "plot"
:
References
Tennekes, M., 2018, tmap: Thematic Maps in R, Journal of Statistical Software, 84(6), 1-39, doi:10.18637/jss.v084.i06
See Also
-
tmap_last()
to show the last map -
tm_view()
for viewing options -
tmap_leaflet()
for obtaining a leaflet widget -
tmap_options()
for tmap options
Examples
current.mode = tmap_mode()
tmap_mode("plot")
tm_shape(World) + tm_polygons("HPI")
tmap_mode("view")
tm_shape(World) + tm_polygons("HPI")
ttm()
tm_shape(World) + tm_polygons("HPI")
tmap_mode(current.mode)
Save tmap
Description
Save tmap to a file. This can be either a static plot (e.g. png) or an interactive map (html).
Usage
tmap_save(
tm = NULL,
filename = NA,
device = NULL,
width = NA,
height = NA,
units = NA,
dpi = NA,
outer.margins = NA,
asp = NULL,
scale = NA,
insets_tm = NULL,
insets_vp = NULL,
add.titles = TRUE,
in.iframe = FALSE,
selfcontained = !in.iframe,
verbose = NULL,
...
)
Arguments
tm |
tmap object |
filename |
filename including extension, and optionally the path.
The extensions pdf, eps, svg, wmf (Windows only), png, jpg, bmp, tiff, and html are supported.
If the extension is missing, the file will be saved as a static plot in |
device |
graphic device to use. Either a device function
(e.g., |
height , width |
The dimensions of the plot (not applicable for html files).
Units are set with the argument |
units |
units for width and height ( |
dpi |
dots per inch. Only applicable for raster graphics. By default it
is set to 300, but this can be changed using the option |
outer.margins |
overrides the outer.margins argument of |
asp |
if specified, it overrides the asp argument of |
scale |
overrides the scale argument of |
insets_tm |
tmap object of an inset map, or a list of tmap objects of
multiple inset maps. The number of tmap objects should be equal to the number
of viewports specified with |
insets_vp |
|
add.titles |
add titles to leaflet object. |
in.iframe |
should an interactive map be saved as an iframe?
If so, two HTML files will be saved; one small parent HTML file with the
iframe container, and one large child HTML file with the actual widget.
See |
selfcontained |
when an interactive map is saved, should the resources
(e.g. JavaScript libraries) be contained in the HTML file? If |
verbose |
Deprecated. It is now controlled by the tmap option |
... |
Arguments passed on to
|
Value
the filename, invisibly, if export is successful.
Examples
## Not run:
data(NLD_muni, NLD_prov)
m <- tm_shape(NLD_muni) +
tm_fill(col="population", convert2density=TRUE,
style="kmeans",
title=expression("Population (per " * km^2 * ")")) +
tm_borders("black", alpha=.5) +
tm_shape(NLD_prov) +
tm_borders("grey25", lwd=2) +
tm_style("classic") +
tm_format("NLD", inner.margins = c(.02, .15, .06, .15)) +
tm_scale_bar(position = c("left", "bottom")) +
tm_compass(position=c("right", "bottom"))
tmap_save(m, "choropleth.png", height = 7) # height interpreted in inches
tmap_save(m, "choropleth_icon.png", height = 100, scale = .1) # height interpreted in pixels
data(World)
m2 <- tm_shape(World) +
tm_fill("well_being", id="name", title="Well-being") +
tm_format("World")
# save image
tmap_save(m2, "World_map.png", width=1920, height=1080, asp=0)
# cut left inner margin to make sure Antarctica is snapped to frame
tmap_save(m2 + tm_layout(inner.margins = c(0, -.1, 0.05, 0.01)),
"World_map2.png", width=1920, height=1080, asp=0)
# save interactive plot
tmap_save(m2, "World_map.html")
## End(Not run)
Set or get the default tmap style
Description
Set or get the default tmap style. Without arguments, the current style is returned.
Also the available styles are displayed. When a style is set, the corresponding tmap
options (see tmap_options()
) will be set accordingly.
The default style (i.e. when loading the package) is "white"
.
Usage
tmap_style(style)
Arguments
style |
Name of the style. When omitted, |
Details
Note that tm_style()
is used within a plot call (so it only affects that plot),
whereas tmap_style()
sets the style globally.
After loading a style, the options that defined this style
(i.e. the difference with the default "white"
style) can be obtained by tmap_options_diff()
.
The documentation of tmap_options()
(details and the examples) shows how to create a new style.
Value
The style before changing
See Also
-
tmap_options()
for tmap options -
tmap_style_catalogue()
to create a style catalogue of all available styles.
Examples
tmap_style()
tm_shape(World) + tm_polygons("HPI")
tmap_style("cobalt")
tm_shape(World) + tm_polygons("HPI")
# for backwards compatibility, the styles of tmap versions 1-3 are also included:
tmap_style("v3")
tm_shape(World) + tm_polygons("HPI")
tmap_style("cobalt_v3")
tm_shape(World) + tm_polygons("HPI")
Create a style catalogue
Description
Create a style catalogue for each predefined tmap style. The result is a set of png images, one for each style.
Usage
tmap_style_catalogue(path = "./tmap_style_previews", styles = NA)
tmap_style_catalog(path = "./tmap_style_previews", styles = NA)
Arguments
path |
path where the png images are stored |
styles |
vector of styles function names (see |
Print a random tip to the console
Description
Print a random tip to the console
Usage
tmap_tip()
Value
A message
Internal methods for tmap extensions
Description
Internal methods for tmap extensions
Usage
toTitleCase(x)
tm_element(..., subclass = NULL)
tm_element_list(...)
tmapChartBinned(chart, bin_colors, breaks_def, na.show, x1)
tmapChartBinned2d(chart, chart1, chart2)
tmapChartBinned2d_numcat(chart, chart1, chart2)
tmapChartBinned2d_numnum(chart, chart1, chart2)
tmapChartBinned2d_catcat(chart, chart1, chart2)
tmapChartRaw(chart, na.show, x1, ...)
tmapChartRaw_nna(chart, na.show, x1, ...)
tmapChartNone(chart, na.show, x1, ...)
tmapChartPass(chart, na.show, x1, ...)
tmapChartBinned_categorical(chart, bin_colors, breaks_def, na.show, x1)
tmapChartBinned_numeric(chart, bin_colors, breaks_def, na.show, x1)
tmapGpar(
fill = NULL,
col = NULL,
shape = NULL,
size = NULL,
fill_alpha = NULL,
col_alpha = NULL,
lty = NULL,
lwd = NULL,
linejoin = NULL,
lineend = NULL,
...
)
tmapTpar(...)
lwd_to_mm(value, unit = "bigpts")
tmapGridLines(
shpTM,
dt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
tmapGridPolygons(
shpTM,
dt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
tmapGridRaster(
shpTM,
dt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
tmapGridSymbols(
shpTM,
dt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
tmapGridText(
shpTM,
dt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
tmapLeafletPolygons(
shpTM,
dt,
pdt,
popup.format,
hdt,
idt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
tmapLeafletLines(
shpTM,
dt,
pdt,
popup.format,
hdt,
idt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o
)
tmapLeafletSymbols(
shpTM,
dt,
pdt,
popup.format,
hdt,
idt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
tmapLeafletRaster(
shpTM,
dt,
gp,
pdt,
popup.format,
hdt,
idt,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
tmapLeafletText(
shpTM,
dt,
gp,
bbx,
facet_row,
facet_col,
facet_page,
id,
pane,
group,
o,
...
)
.TMAP
.TMAP_LEAFLET
.TMAP_GRID
tmapScaleAsIs(
x1,
scale,
legend,
chart,
o,
aes,
layer,
layer_args,
sortRev,
bypass_ord,
submit_legend = TRUE
)
tmapScaleBivariate(
x1,
x2,
scale,
legend,
chart,
o,
aes,
layer,
layer_args,
sortRev,
bypass_ord,
submit_legend = TRUE
)
tmapScaleCategorical(
x1,
scale,
legend,
chart,
o,
aes,
layer,
layer_args,
sortRev,
bypass_ord,
submit_legend = TRUE
)
tmapScaleIntervals(
x1,
scale,
legend,
chart,
o,
aes,
layer,
layer_args,
sortRev,
bypass_ord,
submit_legend = TRUE
)
tmapScaleRank(
x1,
scale,
legend,
chart,
o,
aes,
layer,
layer_args,
sortRev,
bypass_ord,
submit_legend = TRUE
)
tmapUsrCls(x)
format_aes_results(values, ord = NULL, legend, chart)
chart_save(legend)
data_type(x)
data_class(x, check_for_color_class = FALSE, midpoint_enabled = FALSE)
tmapScale(aes, value, scale, legend, chart, free)
tmapScaleAuto(
x1,
scale,
legend,
chart,
o,
aes,
layer,
layer_args,
sortRev,
bypass_ord,
submit_legend = TRUE,
...
)
tmapValuesCheck_col(x, is_var = TRUE)
tmapValuesCheck_fill(x, is_var = TRUE)
tmapValuesCheck_bgcol(x, is_var = TRUE)
tmapValuesCheck_shape(x, is_var = TRUE)
tmapValuesCheck_size(x, is_var = TRUE)
tmapValuesCheck_area(x, is_var = TRUE)
tmapValuesCheck_lwd(x, is_var = TRUE)
tmapValuesCheck_lty(x, is_var = TRUE)
tmapValuesCheck_xmod(x, is_var = TRUE)
tmapValuesCheck_angle(x, is_var = TRUE)
tmapValuesCheck_col_alpha(x, is_var = TRUE)
tmapValuesCheck_fill_alpha(x, is_var = TRUE)
tmapValuesCheck_bgcol_alpha(x, is_var = TRUE)
tmapValuesCheck_area(x, is_var = TRUE)
tmapValuesCheck_text(x, is_var = TRUE)
tmapValuesCheck_fontface(x, is_var = TRUE)
tmapValuesIsDiv_fill(x)
tmapValuesIsDiv_col(x)
tmapValuesIsDiv_bgcol(x)
tmapValuesIsDiv_size(x)
tmapValuesIsDiv_area(x)
tmapValuesIsDiv_lwd(x)
tmapValuesIsDiv_lty(x)
tmapValuesIsDiv_col_alpha(x)
tmapValuesIsDiv_fill_alpha(x)
tmapValuesIsDiv_bgcol_alpha(x)
tmapValuesIsDiv_area(x)
tmapValuesIsDiv_xmod(x)
tmapValuesIsDiv_angle(x)
tmapValuesIsDiv_shape(x)
tmapValuesIsDiv_text(x)
tmapValuesIsDiv_fontface(x)
tmapValuesRange_fill(x, n, isdiv)
tmapValuesRange_col(x, n, isdiv)
tmapValuesRange_bgcol(x, n, isdiv)
tmapValuesRange_shape(x, n, isdiv)
tmapValuesRange_lty(x, n, isdiv)
tmapValuesRange_size(x, n, isdiv)
tmapValuesRange_area(x, n, isdiv)
tmapValuesRange_lwd(x, n, isdiv)
tmapValuesRange_col_alpha(x, n, isdiv)
tmapValuesRange_fill_alpha(x, n, isdiv)
tmapValuesRange_bgcol_alpha(x, n, isdiv)
tmapValuesRange_area(x, n, isdiv)
tmapValuesRange_xmod(x, n, isdiv)
tmapValuesRange_angle(x, n, isdiv)
tmapValuesRange_text(x, n, isdiv)
tmapValuesRange_fontface(x, n, isdiv)
tmapValuesVV_fill(
x,
value.na,
isdiv,
n,
dvalues,
are_breaks,
midpoint,
range,
scale,
rep,
o,
aes = "fill"
)
tmapValuesVV_col(...)
tmapValuesVV_bgcol(...)
tmapValuesVV_shape(
x,
value.na,
isdiv,
n,
dvalues,
are_breaks,
midpoint,
range,
scale,
rep,
o
)
tmapValuesVV_lty(
x,
value.na,
isdiv,
n,
dvalues,
are_breaks,
midpoint,
range,
scale,
rep,
o
)
tmapValuesVV_size(
x,
value.na,
isdiv,
n,
dvalues,
are_breaks,
midpoint,
range,
scale,
rep,
o
)
tmapValuesVV_area(...)
tmapValuesVV_lwd(...)
tmapValuesVV_col_alpha(...)
tmapValuesVV_fill_alpha(...)
tmapValuesVV_bgcol_alpha(...)
tmapValuesVV_area(...)
tmapValuesVV_xmod(...)
tmapValuesVV_angle(...)
tmapValuesVV_text(
x,
value.na,
isdiv,
n,
dvalues,
are_breaks,
midpoint,
range,
scale,
rep,
o
)
tmapValuesVV_fontface(
x,
value.na,
isdiv,
n,
dvalues,
are_breaks,
midpoint,
range,
scale,
rep,
o
)
tmapValuesSubmit_col(x, args)
tmapValuesSubmit_fill(x, args)
tmapValuesSubmit_bgcol(x, args)
tmapValuesSubmit_size(x, args)
tmapValuesSubmit_area(x, args)
tmapValuesSubmit_xmod(x, args)
tmapValuesSubmit_ymod(x, args)
tmapValuesSubmit_angle(x, args)
tmapValuesSubmit_lwd(x, args)
tmapValuesSubmit_lty(x, args)
tmapValuesSubmit_shape(x, args)
tmapValuesSubmit_col_alpha(x, args)
tmapValuesSubmit_fill_alpha(x, args)
tmapValuesSubmit_bgcol_alpha(x, args)
tmapValuesSubmit_text(x, args)
tmapValuesSubmit_fontface(x, args)
tmapValuesScale_col(x, scale)
tmapValuesScale_fill(x, scale)
tmapValuesScale_bgcol(x, scale)
tmapValuesScale_size(x, scale)
tmapValuesScale_area(x, scale)
tmapValuesScale_lwd(x, scale)
tmapValuesScale_lty(x, scale)
tmapValuesScale_shape(x, scale)
tmapValuesScale_col_alpha(x, scale)
tmapValuesScale_fill_alpha(x, scale)
tmapValuesScale_bgcol_alpha(x, scale)
tmapValuesScale_text(x, scale)
tmapValuesScale_fontface(x, scale)
tmapValuesScale_xmod(x, scale)
tmapValuesScale_angle(x, scale)
tmapValuesColorize_col(x, pc)
tmapValuesColorize_fill(x, pc)
tmapValuesColorize_bgcol(x, pc)
tmapValuesColorize_size(x, pc)
tmapValuesColorize_area(x, pc)
tmapValuesColorize_lwd(x, pc)
tmapValuesColorize_lty(x, pc)
tmapValuesColorize_shape(x, pc)
tmapValuesColorize_col_alpha(x, pc)
tmapValuesColorize_fill_alpha(x, pc)
tmapValuesColorize_bgcol_alpha(x, pc)
tmapValuesColorize_text(x, pc)
tmapValuesColorize_fontface(x, pc)
tmapValuesColorize_xmod(x, pc)
tmapValuesColorize_angle(x, pc)
tmapSeq(s, n = NULL)
transform_values(x, lim, rng, power, scale, include.neutral = TRUE)
tmapValuesCVV_fill(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_col(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_bgcol(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_size(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_area(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_lwd(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_col_alpha(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_fill_alpha(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_bgcol_alpha(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_area(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_xmod(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_ymod(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_angle(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_shape(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_lty(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_text(x, value.na, n, range, scale, rep, o)
tmapValuesCVV_fontface(x, value.na, n, range, scale, rep, o)
tmapValuesBVV_fill(x, value.na, m, n, scale, rep, o)
tmapValuesBVV_col(x, value.na, m, n, scale, rep, o)
tmapValuesBVV_bgcol(x, value.na, m, n, scale, rep, o)
tmapValuesCheck_num(x, is_var = TRUE)
tmapValuesIsDiv_num(x)
tmapValuesRange_num(x, n, isdiv)
tmapValuesVV_num(
x,
value.na,
isdiv,
n,
dvalues,
are_breaks,
midpoint,
range,
scale,
rep,
o
)
tmapValuesSubmit_num(x, args)
tmapValuesScale_num(x, scale)
tmapValuesColorize_num(x, pc)
tmapValuesCVV_num(x, value.na, n, range, scale, rep, o)
tmapValuesCheck_skip(x, is_var)
tmapValuesIsDiv_skip(x)
tmapValuesRange_skip(x, n, isdiv)
tmapValuesVV_skip(
x,
value.na,
isdiv,
n,
dvalues,
are_breaks,
midpoint,
range,
scale,
rep,
o
)
tmapValuesSubmit_skip(x, args)
tmapValuesScale_skip(x, scale)
tmapValuesColorize_skip(x, pc)
tmapValuesCVV_skip(x, value.na, n, range, scale, rep, o)
tmapTransCentroid(
shpTM,
xmod = NULL,
ymod = NULL,
ord__,
plot.order,
args,
scale
)
tmapTransRaster(shpTM, ord__, plot.order, args)
tmapTransPolygons(shpTM, ord__, plot.order, args, scale)
tmapTransLines(shpTM, ord__, plot.order, args, scale)
Arguments
... |
args |
subclass |
subclass |
fill , col , shape , size , fill_alpha , col_alpha , lty , lwd , linejoin , lineend |
visual variables |
shpTM |
shpTM |
scale |
scale |
args |
args |
xmod , ymod |
xmod and ymod |
ord__ |
ord |
plot.order |
plot.order |
Format
An object of class environment
of length 9.
An object of class environment
of length 0.
An object of class environment
of length 1.