create_geography: Create geography

Description Usage Arguments Value Examples

View source: R/create_geography.R

Description

This function creates the geography for a map of the European Union (EU) made by eumaps::make_map(). It creates a object of type eumaps.geography, which you can pass to the geography argument of make_maps().

create_geography() will automatically center the map on all countries that are member states on the date indicated by the argument date. This way, you never have to specify the bounds of the map, which can be complicated, depending on the map projection you want to use. You also don't have to know the accession dates of the member states. By default, date is set to today's date. You can use the optional argument subset to center the map on a subset of member states.

You can use create_geography() to set a variety of other options that make it easy to make the map look exactly how you want.

First, you can use the argument aspect_ratio to specify the aspect ratio of the map. A value greater than 1 makes a map that is wider than it is tall and a value less than 1 makes a map that is taller than it is wide. The minimum value is 0.5 and the maximum value is 2.

Second, you can use zoom to choose a zoom factor. A value of 1 focuses the map tightly around the selected member states, and values less than 1 zoom out the map. The minimum value is 0.5. The default is 0.9.

Third, you can use show_non_member_states to choose whether or not to plot non-member states. The default value is TRUE.

Fourth, you can use insets to create insets for member states whose values would be hard to read otherwise. By default, insets equals NULL, in which case no insets are created. You can provide a vector of member state names to create insets for those member states. You can create insets for Luxembourg, Malta, and Cyprus. The insets will appear in the top right corner of the map in the order given by the vector.

Fifth, you can use projection to choose between 5 common map projections that are appropriate for Europe. You can run list_projections() to see the possible values.

Finally, you can use resolution to choose between low or high resolution border data. The default value is high and the alternative is low. The map will take longer to render if you use the high resolution data. The function always uses high resolution border data for the insets.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
create_geography(
  date = Sys.Date(),
  subset = NULL,
  aspect_ratio = NULL,
  zoom = 0.9,
  show_non_member_states = TRUE,
  insets = NULL,
  projection = "lambert_azimuthal_equal_area",
  resolution = "high"
)

Arguments

date

String or date. Required, and has a default value. The date of the data. If a string, needs to have the format YYYY-MM-DD. The default is today's date.

subset

String. Optional. A vector of member state names. The map will be centered on these member states. If NULL, the map will be centered on all member states. Any countries in the vector that aren't member states on the date indicated by date will be ignored. The default value is NULL.

aspect_ratio

Numeric. Optional. The aspect ratio of the map. The minimum value is 0.5 and the maximum value is 2. If NULL, the aspect ratio will be determined by the bounding box surrounding the selected member states. The default value is NULL.

zoom

Numeric. Required, and has a default value. The zoom factor. A value of 1 focuses the map tightly around the selected member states, and values less than 1 zoom out the map. The minimum value is 0.5 and the maximum value is 1. The default value is 0.9.

show_non_member_states

Logical. Required, and has a default value. Whether or not to plot non-member states. The default value is TRUE.

insets

String. Optional. A vector of member states to create insets for. Possible values include Luxembourg, Cyprus, and Malta. Other countries will be ignored. If NULL, no insets are created. The default value is NULL.

projection

String. Required, and has a default value. The map projection to use. The possible values are equidistant_conic, lambert_conformal_conic, albers_equal_area_conic, lambert_azimuthal_equal_area, and mercator. The default value is lambert_azimuthal_equal_area.

resolution

String. Required, and has a default value. The resolution to use for the border data. The possible values are high and low. The default is high.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# using the default values
geography <- create_geography()

# using all options
create_geography <- function(
  date = Sys.Date(),
  subset = NULL,
  aspect_ratio = NULL,
  zoom = 0.9,
  show_non_member_states = TRUE,
  insets = NULL,
  projection = "lambert_azimuthal_equal_area",
  resolution = "high"
)

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