European Union countries

This example demonstrates how to combine two or more named domains into a union of domains. In this example, we take a list of countries that have European Union membership and create a domain that is optimised to show them all.

[1]:
import earthkit.plots as ekp
from earthkit.plots.geography import domains

EU_COUNTRIES = [
    "Austria",
    "Belgium",
    "Bulgaria",
    "Croatia",
    "Cyprus",
    "Czech Republic",
    "Denmark",
    "Estonia",
    "Finland",
    "France",
    "Germany",
    "Greece",
    "Hungary",
    "Ireland",
    "Italy",
    "Latvia",
    "Lithuania",
    "Luxembourg",
    "Netherlands",
    "Poland",
    "Portugal",
    "Romania",
    "Slovakia",
    "Slovenia",
    "Spain",
    "Sweden",
]

EU = domains.union(EU_COUNTRIES, name="European Union")

# domain=EU_COUNTRIES is also valid but would lose the name metadata
eu_map = ekp.Map(domain=EU)

eu_map.countries(edgecolor="white")

# We can reuse the same list of EU countries to show a subset of country polygons
eu_map.countries(include=EU_COUNTRIES, facecolor="cornflowerblue", edgecolor="white", labels=True)

eu_map.gridlines()
eu_map.title("{domain}")

# You can pass an earthkit-plots Style directly to the legend method
eu_map.legend(
    ekp.styles.Categorical(
        categories=["Non-EU countries", "EU countries"],
        colors=["lightgrey", "cornflowerblue"],
    )
)

eu_map.show()
../../../_images/examples_gallery_domains_domain-union_2_0.png