create_theme: Create a theme

Description Usage Arguments Value Examples

View source: R/create_theme.R

Description

This function creates a theme for a map of the European Union (EU) made by eumaps::make_map(). It creates an object of class eumaps.theme, which you can pass to the theme argument of make_map(). An eumaps.theme object defines the aesthetics of the map, including the style of the map border, the country borders, the title, the legend, and any insets.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
create_theme(
  color_map_background = c(1, 1, 1),
  color_map_border = c(0, 0, 0),
  width_map_border = 1,
  space_around_map = 16,
  color_country_borders = c(0, 0, 0),
  width_country_borders = 0.25,
  size_title = 16,
  space_under_title = 8,
  size_legend_keys = 22,
  space_before_legend = 16,
  space_between_legend_keys = 8,
  size_legend_labels = 10,
  space_before_legend_labels = 8,
  size_insets = 0.15,
  space_between_insets = 0.03
)

Arguments

color_map_background

Color. Required, and has a default value. The color of the background of the map (i.e., the color of the water). Can be any value accepted by convert_color(). The default value is #FFFFFFFF.

color_map_border

Color. Required, and has a default value. The color of the border around the map. Can be any value accepted by convert_color(). The default value is #000000FF.

width_map_border

Numeric. Required, and has a default value. The width of the border around the map in px. The default value is 1.

space_around_map

Numeric. Required, and has a default value. The space between the border around the map and the edge of the plot in px. The default value is 16.

color_country_borders

Color. Required, and has a default value. The color of the country borders. Can be any value accepted by convert_color(). The default value is #000000FF.

width_country_borders

Numeric. Required, and has a default value. The width of the country borders in px. The default value is 0.25.

size_title

Numeric. Required, and has a default value. The size of the title of the map in points. The default value is 16.

space_under_title

Numeric. Required, and has a default value. The vertical space between the bottom of the map title and the top of the border around the map in px. The default value is 8.

size_legend_keys

Numeric. Required, and has a default value. The size of the legend keys in px. This value is for both the horizontal and vertical size of the keys. The default value is 18.

space_before_legend

Numeric. Required, and has a default value. The horizontal space between the right border of the map and the legend in px. The default value is 16.

space_between_legend_keys

Numeric. Required, and has a default value. The vertical space between legend keys in px. The default value is 8.

size_legend_labels

Numeric. Required, and has a default value. The size of the labels of the legend keys in points. The default value is 10.

space_before_legend_labels

Numeric. Required, and has a default value. The horizontal space between the right side of the legend keys and the labels of the keys in px. The default value is 8.

size_insets

Numeric. Required, and has a default value. The size of the insets as a percentage of the height of the map. This value is for both the horizontal and vertical size of the insets. Values between 0.15 and 0.2 usually look good. The default value is 0.15.

space_between_insets

Numeric. Required, and has a default value. The vertical space between insets (and between the column of insets and the right border of the map) as a percentage of the height of the map. Values between 0.03 and 0.04 usually look good. The default value is 0.03.

Value

This function returns an object of class eumaps.theme, which you can pass to the theme argument of make_maps().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# using the default values
theme <- create_theme()

# using all options
theme <- create_theme(
  color_map_background = c(1, 1, 1),
  color_map_border = c(0, 0, 0),
  width_map_border = 1,
  space_around_map = 16,
  color_country_borders = c(0, 0, 0),
  width_country_borders = 0.25,
  size_title = 16,
  space_under_title = 8,
  size_legend_keys = 18,
  space_before_legend = 16,
  space_between_legend_keys = 8,
  size_legend_labels = 10,
  space_before_legend_labels = 8,
  size_insets = 0.15,
  space_between_insets = 0.03
)

jfjelstul/eumaps documentation built on Jan. 8, 2022, 1:17 a.m.