Description Usage Arguments Value Examples
View source: R/create_geography.R
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.
1 2 3 4 5 6 7 8 9 10 |
date |
String or date. Required, and has a default value. The date of
the data. If a string, needs to have the format |
subset |
String. Optional. A vector of member state names. The map will
be centered on these member states. If |
aspect_ratio |
Numeric. Optional. The aspect ratio of the map. The
minimum value is |
zoom |
Numeric. Required, and has a default value. The zoom factor. A
value of |
show_non_member_states |
Logical. Required, and has a default value.
Whether or not to plot non-member states. The default value is |
insets |
String. Optional. A vector of member states to create insets
for. Possible values include |
projection |
String. Required, and has a default value. The map
projection to use. The possible values are |
resolution |
String. Required, and has a default value. The resolution
to use for the border data. The possible values are |
This function returns an object of type eumaps.geography
, which you
can pass to the geography
argument of make_maps()
.
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"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.