This function set a map theme.
The parameters set by this function are the figure margins, background and
foreground colors and some mf_title options.
Use mf_theme(NULL)
or mf_theme('default')
to reset to default
theme settings.
Arguments
- x
name of a map theme. One of "default", "brutal", "ink", "dark", "agolalight", "candy", "darkula", "iceberg", "green", "nevermind", "jsk", "barcelona".
- bg
background color
- fg
foreground color
- mar
margins
- tab
if TRUE the title is displayed as a 'tab'
- pos
title position, one of 'left', 'center', 'right'
- inner
if TRUE the title is displayed inside the plot area.
- line
number of lines used for the title
- cex
cex of the title
- font
font of the title
Details
It is also possible to set a custom theme using a list of arguments
(see Examples).
mf_theme()
returns the current theme settings.
Examples
mtq <- mf_get_mtq()
# Choosing a theme by name:
mf_theme("default")
mf_map(mtq)
mf_title()
# Specifying some values directly:
mf_theme(bg = "darkslategrey", fg = "lightgrey")
mf_map(mtq)
mf_title()
# Using a mix of the above:
mf_theme("brutal", fg = "lightgreen", pos = "center", font = 2, tab = FALSE)
mf_map(mtq)
mf_title()
# Specifying a list with theme values:
theme <- mf_theme("default")
theme$mar <- c(1, 1, 3, 1)
theme$line <- 2
theme$cex <- 1.5
mf_theme(theme)
mf_map(mtq)
mf_title()
# or
theme <- list(
bg = "green",
fg = "red",
mar = c(2, 2, 2, 2),
tab = TRUE,
pos = "center",
inner = TRUE,
line = 2,
cex = 1.5,
font = 3
)
mf_theme(theme)
mf_map(mtq)
mf_title()
# Obtaining a list of parameters for the current theme:
mf_theme()
#> $bg
#> [1] "green"
#>
#> $fg
#> [1] "red"
#>
#> $mar
#> [1] 2 2 2 2
#>
#> $tab
#> [1] TRUE
#>
#> $pos
#> [1] "center"
#>
#> $inner
#> [1] TRUE
#>
#> $line
#> [1] 2
#>
#> $cex
#> [1] 1.5
#>
#> $font
#> [1] 3
#>
# Removing the current theme:
mf_theme(NULL)
# or
mf_theme("default")