Skip to main content

Ukraine maps for pygal

Project description

pygal_maps_ua

Ukraine maps for pygal

🇺🇦 Читати українською

Ukraine map plugin for Pygal

Allows you to create first level division administrative map of Ukraine

At the first level Ukraine is divided into 27 regions: 24 oblasts (regions), 1 autonomous republic (Crimea) and 2 cities with special status (Kyiv, Sevastopol)

Install

pip install pygal_maps_ua

Usage

This package is a plugin for an open-source data visualization library Pygal, so please refer the Pygal and Pygal / Chart types / Maps documentation for deeper understanding of the code below

from pygal.maps.ua import Regions

map = Regions()
map.title = 'Regions with highly confused name'
map.add('Cherkasy', ['cherkasy'])
map.add('Сhernihiv', ['chernihiv'])
map.add('Сhernivtsi', ['chernivtsi'])

map.render_to_png('chart.png')

Result:

alt text

You can also specify a value for the region

from pygal_maps_ua.maps import Regions, REGIONS_UA

map = Regions()
map.title = 'Number of letters in the region name'
map.add(
    "Letters count", 
    {x: len(y) for x, y in REGIONS_UA.items()}
)

map.render_to_png('chart.png')

Result:

alt text

Temporarily occupied territories

It is possible to render a map with the schematic visualization of temporarily occupied territories of Donetsk and Luhansk regions (known as ORDLO). This area refers to territories occupied by Russia in the 2014 year) and don't refer to territories, occupied by Russia during full-scale Russian invasion of Ukraine in 2022

You can use such a template by calling the RegionsOrdlo class and refer the occupied regions area and ordlo key respectively

from pygal.maps.ua import RegionsOrdlo

map = RegionsOrdlo()

⚠ Warning

It should be a valid reason to use such a map template instead of Regions template

The straight use-case is to visualize some statistical data from 2014 and clearly display that you have no data from the temporarily occupied territories

It is strictly forbidden to use this map template to dispute in any way the sovereignty and territorial integrity of Ukraine (including marking occupied territories as "disputed", "unrecognised", "self-proclaimed" or using any other formulations except "occupied" or "temporarily occupied" according to the UN resolutions 73/194, ES-11/4 and common sense).

The example of using the RegionsOrdlo for the use-case of visualizing the population of Ukraine on 1 Jan 2020 is provided below:

(data source)

from pygal.maps.ua import RegionsOrdlo

population_2020_by_region = {
    "vinnytsia" :1545416,
    "volyn" :1031421,
    "dnipropetrovsk" :3176648,
    "donetsk" :4131808,
    "zhytomir" :1208212,
    "zakarpattia" :1253791,
    "zaporizhzhia" :1687401,
    "ivano-frankivsk" :1368097,
    "kyiv" :1781044,
    "kirovohrad" :933109,
    "luhansk" :2135913,
    "lviv" :2512084,
    "mykolaiv" :1119862,
    "odesa" :2377230,
    "poltava" :1386978,
    "rivne" :1152961,
    "sumy" :1068247,
    "ternopil" :1038695,
    "kharkiv" :2658461,
    "kherson" :1027913,
    "khmelnitskyi" :1254702,
    "cherkasy" :1192137,
    "chernivtsi" :901632,
    "chernihiv" :991294,
    "kyivcity" :2967360,
}


map = RegionsOrdlo(legend_at_bottom=True)

map.title = 'Population by region on 01 Jan 2020'
map.add('Population', population_2020_by_region)
map.add('Temporarily occupied territories', ['ordlo', 'crimea', 'sevastopolcity'])

map.render_to_png('chart.png')

Result:

alt text

List of available regions

List of available regions is set as variables REGIONS_UA and REGIONS_ENG respectively and listed below:

key description [ua] description [en]
cherkasy Черкаська область Cherkasy Oblast
chernihiv Чернігівська область Chernihiv Oblast
chernivtsi Чернівецька область Chernivtsi Oblast
crimea Автономна Республіка Крим Autonomous Republic of Crimea
dnipropetrovsk Дніпропетровська область Dnipropetrovsk Oblast
donetsk Донецька область Donetsk Oblast
ivano-frankivsk Івано-Франківська область Ivano-Frankivsk Oblast
kharkiv Харківська область Kharkiv Oblast
kherson Херсонська область Kherson Oblast
khmelnitskyi Хмельницька область Khmelnytskyi Oblast
kyiv Київська область Kyiv Oblast
kyivcity Київ Kyiv
kirovohrad Кіровоградська область Kirovohrad Oblast
lviv Львівська область Lviv Oblast
luhansk Луганська область Luhansk Oblast
mykolaiv Миколаївська область Mykolaiv Oblast
odesa Одеська область Odesa Oblast
poltava Полтавська область Poltava Oblast
rivne Рівненська область Rivne Oblast
sevastopolcity Севастополь Sevastopol
sumy Сумська область Sumy Oblast
ternopil Тернопільська область Ternopil Oblast
vinnytsia Вінницька область Vinnytsia Oblast
volyn Волинська область Volyn Oblast
zakarpattia Закарпатська область Zakarpattia Oblast
zaporizhzhia Запорізька область Zaporizhzhia Oblast
zhytomir Житомирська область Zhytomyr Oblast

If you need to update the region names for your purposes (e.g. use only city names), use the set_regions or set_regions_eng functions

If you would like to support the author consider donating to the United24 charity foundation
Data Source for Ukraine ADM1 borders:

Hijmans, Robert J.. University of California, Berkeley. Museum of Vertebrate Zoology. First-level Administrative Divisions, Ukraine, 2015. [Shapefile]. University of California, Berkeley. Museum of Vertebrate Zoology. Retrieved from https://maps.princeton.edu/catalog/stanford-gg870xt4706

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygal_maps_ua-1.0.2.tar.gz (235.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygal_maps_ua-1.0.2-py3-none-any.whl (239.3 kB view details)

Uploaded Python 3

File details

Details for the file pygal_maps_ua-1.0.2.tar.gz.

File metadata

  • Download URL: pygal_maps_ua-1.0.2.tar.gz
  • Upload date:
  • Size: 235.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pygal_maps_ua-1.0.2.tar.gz
Algorithm Hash digest
SHA256 818b3351e17219a9f86fcdd3909a005927b916c7d5a86c7c561cc9e529765aa5
MD5 499e87ca197b420392271312580e638a
BLAKE2b-256 c2d01a825289447a088be8604c31b07bc69f9a6d97a91739a55d6aacc5ebf771

See more details on using hashes here.

File details

Details for the file pygal_maps_ua-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pygal_maps_ua-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 239.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pygal_maps_ua-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2303e86da759d46512fa1b6edd8e6fedbd6b9662f723bd0030886efc27999b03
MD5 d633f50f56e06eaad24eb401fa52670b
BLAKE2b-256 a3de7a096a198142c38dec436e830d207a88ad2c69ab8be11a81b5456f0bf590

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page