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()
.
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.color,
outer.bg.color,
frame,
frame.lwd,
frame.r,
frame.double_line,
outer.margins,
inner.margins,
inner.margins.extra,
meta.margins,
meta.auto_margins,
between_margin,
panel.margin,
component.offset,
component.stack_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.autoscale,
legend.show,
legend.design,
legend.orientation,
legend.position,
legend.width,
legend.height,
legend.stack,
legend.group.frame,
legend.resize_as_group,
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.lwd,
legend.frame.r,
legend.bg.color,
legend.bg.alpha,
legend.only,
legend.absolute_fontsize,
legend.settings.standard.portrait,
legend.settings.standard.landscape,
chart.show,
chart.plot.axis.x,
chart.plot.axis.y,
chart.position,
chart.width,
chart.height,
chart.stack,
chart.group.frame,
chart.resize_as_group,
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.lwd,
chart.frame.r,
chart.bg.color,
chart.bg.alpha,
chart.object.color,
title.size,
title.color,
title.fontface,
title.fontfamily,
title.alpha,
title.bg.color,
title.bg.alpha,
title.padding,
title.frame,
title.frame.lwd,
title.frame.r,
title.stack,
title.position,
title.width,
title.group.frame,
title.resize_as_group,
credits.size,
credits.color,
credits.fontface,
credits.fontfamily,
credits.alpha,
credits.bg.color,
credits.bg.alpha,
credits.padding,
credits.frame,
credits.frame.lwd,
credits.frame.r,
credits.stack,
credits.position,
credits.width,
credits.height,
credits.group.frame,
credits.resize_as_group,
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.bg.color,
compass.bg.alpha,
compass.margins,
compass.stack,
compass.position,
compass.frame,
compass.frame.lwd,
compass.frame.r,
compass.group.frame,
compass.resize_as_group,
logo.height,
logo.margins,
logo.between_margin,
logo.stack,
logo.position,
logo.frame,
logo.frame.lwd,
logo.frame.r,
logo.group.frame,
logo.resize_as_group,
scalebar.breaks,
scalebar.width,
scalebar.text.size,
scalebar.text.color,
scalebar.color.dark,
scalebar.color.light,
scalebar.lwd,
scalebar.bg.color,
scalebar.bg.alpha,
scalebar.size,
scalebar.margins,
scalebar.stack,
scalebar.position,
scalebar.frame,
scalebar.frame.lwd,
scalebar.frame.r,
scalebar.group.frame,
scalebar.resize_as_group,
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.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.stack,
mouse_coordinates.position,
mouse_coordinates.show,
minimap.server,
minimap.toggle,
minimap.stack,
minimap.position,
minimap.show,
panel.show,
panel.labels,
panel.label.size,
panel.label.color,
panel.label.fontface,
panel.label.fontfamily,
panel.label.alpha,
panel.label.bg.color,
panel.label.frame,
panel.label.frame.lwd,
panel.label.frame.r,
panel.label.height,
panel.label.rot,
bbox,
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,
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)
List of tmap options to be set, or option names (characters) to be returned (see details)
Map crs (see tm_shape()
). NA
means the crs is specified in tm_shape()
. The crs that is used by the transformation functions is defined in tm_shape()
.
Maximum number of facets
Should facets be flipped (in case of facet wrap)? This can also be set via tm_facets_flip()
For backward compatibility: if this value is set, it will be used to impute the free arguments in the layer functions
Maximum number of raster grid cells. Can be mode specific c(plot = 3000, view = 1000, 1000)
(the last value is the fall back default)
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 warnings?
Output format
Output size
Output dpi
Output dpi for animations
Default visual value constants e.g. the default fill color for tm_shape(World) + tm_polygons()
. A list is required with per visual variable a value.
Default visual values that are used to visualize NA data values. A list is required with per visual variable a value.
Default visual values that are used to visualize null (out-of-scope) data values. A list is required with per visual variable a value.
Default visual values that correspond to blank. For color these are "#00000000"
meaning transparent. A list is required with per visual variable a value.
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.
Default range for values. See values.range
of tm_scale_categorical()
. A list is required with per visual variable a value.
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.
Default scales (as in object sizes) for values. See values.range
of tm_scale_categorical()
. A list is required with per visual variable a value.
Default scale functions per visual variable and type of data variable. A list is required with per visual variable per data type.
Default values of scale function-specific arguments. A list is required with per scale function and optional per visual variable.
The number of continuous legend breaks within one 'unit' (label). The default value is 50.
the number of classes of a continuous scale. Should be odd. The default value is 101.
Format for the labels (was legend.format
in tmap v3).
Default label for missing values.
Overall scale of the map
Aspect ratio of each map. When asp
is set to NA
(default) the aspect ratio will be adjusted to the used shapes. When set to 0 the aspect ratio is
adjusted to the size of the device divided by the number of columns and rows.
Background color of the map.
Background color of map outside the frame.
Overall frame of the map
The line width of the frame. See graphics::par
, option 'lwd'.
The r (radius) of the frame.
The double line of the frame. TRUE
or FALSE
.
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).
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).
The extra arguments of the margins of the inner space (inside the frame). A list of arguments.
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).
The auto_margins of the meta.
Margin between the map.
The margin of the panel.
The offset of the component.
The stack_margin of the component.
The height of the mark of the grid.
The height of the xylab.
The height of the coords.
The visibility of the xlab. TRUE
or FALSE
.
The text of the xlab.
The size of the xlab.
The color of the xlab.
The rotation of the xlab.
The space of the xlab. In terms of number of text line heights.
The font face of the xlab. See graphics::par
, option 'font'.
The font family of the xlab. See graphics::par
, option 'family'.
The alpha transparency of the xlab.
The side of the xlab.
The visibility of the ylab. TRUE
or FALSE
.
The text of the ylab.
The size of the ylab.
The color of the ylab.
The rotation of the ylab.
The space of the ylab. In terms of number of text line heights.
The font face of the ylab. See graphics::par
, option 'font'.
The font family of the ylab. See graphics::par
, option 'family'.
The alpha transparency of the ylab.
The side of the ylab.
The type of the panel.
The panel positions for wrapped facets created with tm_facets_grid()
. One of "left"
, "right"
, "top"
(default) or "bottom"
.
The panel positions for grid facets created with tm_facets_grid()
. Vector of two, where the first determines the locations of row panels ("left"
or "right"
) and the second the location of column panels ( "top"
or `"bottom")
Unit of the coordinate
The sepia_intensity of the color.
The saturation of the color.
`Color vision deficiency simulation
The font face of the text. See graphics::par
, option 'font'.
The font family of the text. See graphics::par
, option 'family'.
The alpha transparency of the text.
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
The autoscale of the component.
The visibility of the legend. TRUE
or FALSE
.
The design of the legend.
The orientation of the legend.
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
The width of the legend.
The height of the legend.
The stack of the legend.
The frame of the group of the legend.
The resize_as_group of the legend.
The reverse of the legend.
The visibility of the na of the legend. TRUE
or FALSE
.
The color of the title of the legend.
The size of the title of the legend.
The font face of the title of the legend. See graphics::par
, option 'font'.
The font family of the title of the legend. See graphics::par
, option 'family'.
The alpha transparency of the title of the legend.
The color of the xlab of the legend.
The size of the xlab of the legend.
The font face of the xlab of the legend. See graphics::par
, option 'font'.
The font family of the xlab of the legend. See graphics::par
, option 'family'.
The alpha transparency of the xlab of the legend.
The color of the ylab of the legend.
The size of the ylab of the legend.
The font face of the ylab of the legend. See graphics::par
, option 'font'.
The font family of the ylab of the legend. See graphics::par
, option 'family'.
The alpha transparency of the ylab of the legend.
The color of the text of the legend.
The size of the text of the legend.
The font face of the text of the legend. See graphics::par
, option 'font'.
The font family of the text of the legend. See graphics::par
, option 'family'.
The alpha transparency of the text of the legend.
The frame of the legend.
The line width of the frame of the legend. See graphics::par
, option 'lwd'.
The r (radius) of the frame of the legend.
The color of the bg of the legend.
The alpha transparency of the bg of the legend.
The only of the legend.
The absolute fontsize of the legend. So far, only used to calculate legend dimensions
The portrait of the standard of the settings of the legend.
The landscape of the standard of the settings of the legend.
The visibility of the chart. TRUE
or FALSE
.
The x of the axis of the plot of the chart.
The y of the axis of the plot of the chart.
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
The width of the chart.
The height of the chart.
The stack of the chart.
The frame of the group of the chart.
The resize_as_group of the chart.
The reverse of the chart.
The visibility of the na of the chart. TRUE
or FALSE
.
The color of the title of the chart.
The size of the title of the chart.
The font face of the title of the chart. See graphics::par
, option 'font'.
The font family of the title of the chart. See graphics::par
, option 'family'.
The alpha transparency of the title of the chart.
The color of the xlab of the chart.
The size of the xlab of the chart.
The font face of the xlab of the chart. See graphics::par
, option 'font'.
The font family of the xlab of the chart. See graphics::par
, option 'family'.
The alpha transparency of the xlab of the chart.
The color of the ylab of the chart.
The size of the ylab of the chart.
The font face of the ylab of the chart. See graphics::par
, option 'font'.
The font family of the ylab of the chart. See graphics::par
, option 'family'.
The alpha transparency of the ylab of the chart.
The color of the text of the chart.
The size of the text of the chart.
The font face of the text of the chart. See graphics::par
, option 'font'.
The font family of the text of the chart. See graphics::par
, option 'family'.
The alpha transparency of the text of the chart.
The frame of the chart.
The line width of the frame of the chart. See graphics::par
, option 'lwd'.
The r (radius) of the frame of the chart.
The color of the bg of the chart.
The alpha transparency of the bg of the chart.
The color of the object of the chart.
The size of the title.
The color of the title.
The font face of the title. See graphics::par
, option 'font'.
The font family of the title. See graphics::par
, option 'family'.
The alpha transparency of the title.
The color of the bg of the title.
The alpha transparency of the bg of the title.
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).
The frame of the title.
The line width of the frame of the title. See graphics::par
, option 'lwd'.
The r (radius) of the frame of the title.
The stack of the title.
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
The width of the title.
The frame of the group of the title.
The resize_as_group of the title.
The size of the credits.
The color of the credits.
The font face of the credits. See graphics::par
, option 'font'.
The font family of the credits. See graphics::par
, option 'family'.
The alpha transparency of the credits.
The color of the bg of the credits.
The alpha transparency of the bg of the credits.
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).
The frame of the credits.
The line width of the frame of the credits. See graphics::par
, option 'lwd'.
The r (radius) of the frame of the credits.
The stack of the credits.
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
The width of the credits.
The height of the credits.
The frame of the group of the credits.
The resize_as_group of the credits.
The north of the compass.
The type of the compass.
The size of the text of the compass.
The size of the compass.
The labels of the show of the compass.
The directions of the cardinal of the compass.
The color of the text of the compass.
The dark of the color of the compass.
The light of the color of the compass.
The line width of the compass. See graphics::par
, option 'lwd'.
The color of the bg of the compass.
The alpha transparency of the bg of the compass.
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).
The stack of the compass.
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
The frame of the compass.
The line width of the frame of the compass. See graphics::par
, option 'lwd'.
The r (radius) of the frame of the compass.
The frame of the group of the compass.
The resize_as_group of the compass.
The height of the logo.
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).
The between_margin of the logo.
The stack of the logo.
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
The frame of the logo.
The line width of the frame of the logo. See graphics::par
, option 'lwd'.
The r (radius) of the frame of the logo.
The frame of the group of the logo.
The resize_as_group of the logo.
The break values of the scalebar.
The width of the scalebar.
The size of the text of the scalebar.
The color of the text of the scalebar.
The dark of the color of the scalebar.
The light of the color of the scalebar.
The line width of the scalebar. See graphics::par
, option 'lwd'.
The color of the bg of the scalebar.
The alpha transparency of the bg of the scalebar.
The size of the scalebar.
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).
The stack of the scalebar.
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
The frame of the scalebar.
The line width of the frame of the scalebar. See graphics::par
, option 'lwd'.
The r (radius) of the frame of the scalebar.
The frame of the group of the scalebar.
The resize_as_group of the scalebar.
The visibility of the grid. TRUE
or FALSE
.
The pos of the labels of the grid.
The x of the grid.
The y of the grid.
The x of the n of the grid.
The y of the n of the grid.
The coordinate reference system (CRS) of the grid.
The color of the grid.
The line width of the grid. See graphics::par
, option 'lwd'.
The alpha transparency of the grid.
The visibility of the labels of the grid. TRUE
or FALSE
.
The size of the labels of the grid.
The color of the labels of the grid.
The rot of the labels of the grid.
The format of the labels of the grid.
The cardinal of the labels of the grid.
The x of the margin of the labels of the grid.
The y of the margin of the labels of the grid.
The x of the space of the labels of the grid.
The y of the space of the labels of the grid.
The inside_frame of the labels of the grid.
The ticks of the grid.
The lines of the grid.
The ndiscr of the grid.
The stack of the mouse_coordinates.
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
The visibility of the mouse_coordinates. TRUE
or FALSE
.
The server of the minimap.
The toggle of the minimap.
The stack of the minimap.
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
The visibility of the minimap. TRUE
or FALSE
.
The visibility of the panel. TRUE
or FALSE
.
The labels of the panel.
The size of the label of the panel.
The color of the label of the panel.
The font face of the label of the panel. See graphics::par
, option 'font'.
The font family of the label of the panel. See graphics::par
, option 'family'.
The alpha transparency of the label of the panel.
The color of the bg of the label of the panel.
The frame of the label of the panel.
The line width of the frame of the label of the panel. See graphics::par
, option 'lwd'.
The r (radius) of the frame of the label of the panel.
The height of the label of the panel.
The rot of the label of the panel.
Bounding box of the map (only used if shp
is the main shape (see is.main
)
The scalebar of the qtm.
The minimap of the qtm.
The mouse_coordinates of the qtm.
The earth boundary
The color of the earth_boundary.
The line width of the earth_boundary. See graphics::par
, option 'lwd'.
Earth datum
The color of the space.
Should attempt to fix an invalid shapefile
The visibility of the basemap. TRUE
or FALSE
.
The server of the basemap.
The alpha transparency of the basemap.
The zoom of the basemap.
The visibility of the tiles. TRUE
or FALSE
.
The server of the tiles.
The alpha transparency of the tiles.
The zoom of the tiles.
The color of the attr.
Only used internally (work in progress)
The used crs for world maps
Use gradient fill using linearGradient()
If TRUE
it opens an external browser, and FALSE
(default) it opens the internal IDEs (e.g. RStudio) browser.
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 TRUE
for large spatial objects (500 or more features) when the mentioned criteria are met.
By default TRUE
if no other visual variables are used.
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
base layers
overlay layers
Should the box be collapsed or expanded?
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()
numeric vector that determines the view.
Either a vector of three: lng
, lat
, and zoom
, or a single value:
zoom
. See setView().
Only applicable if bbox
is not specified
numeric vector of two that set the minimum and maximum zoom levels (see tileOptions()).
If TRUE
(default) circle shaped symbols (e.g. tm_dots()
and tm_symbols()
) will be rendered as addCircleMarkers() instead of addMarkers(). The former is faster, the latter can support any symbol since it is based on icons
options passed on to leafletOptions()
deprecated See tm_title()
deprecated See tm_title()
deprecated. Use the title.
options instead.
renamed to text.fontface
and text.fontfamily
mode, e.g. "plot"
or "view"
style, see tmap_style()
for available styles
Should only mode-specific options be returned? TRUE
by default.
return the default options or the current options?
# 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 = "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()
Run the code above in your browser using DataLab