Skip to content

Commit c901eff

Browse files
authored
Merge branch 'main' into ci/readd-codecov-upload
2 parents 8ec9803 + dba5f4e commit c901eff

8 files changed

Lines changed: 689 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
run: ${{ (github.event_name == 'push' && github.ref_name == 'main') && 'true' || steps.filter.outputs.python }}
1313
steps:
1414
- uses: actions/checkout@v6
15-
- uses: dorny/paths-filter@v3
15+
- uses: dorny/paths-filter@v4
1616
id: filter
1717
with:
1818
filters: |

docs/examples/geo/04_choropleth.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""
2+
Simple choropleth
3+
=================
4+
5+
Color country-level values directly on a geographic axes.
6+
7+
Why UltraPlot here?
8+
-------------------
9+
UltraPlot now exposes :meth:`~ultraplot.axes.GeoAxes.choropleth`, so you can
10+
draw country-level thematic maps from plain ISO-style identifiers while using
11+
the same concise colorbar and formatting API used elsewhere in the library.
12+
13+
Key functions: :py:func:`ultraplot.subplots`, :py:meth:`ultraplot.axes.GeoAxes.choropleth`.
14+
15+
See also
16+
--------
17+
* :doc:`Geographic projections </projections>`
18+
"""
19+
20+
import numpy as np
21+
22+
import ultraplot as uplt
23+
24+
country_values = {
25+
"AUS": 1.2,
26+
"BRA": 2.6,
27+
"IND": 3.4,
28+
"ZAF": np.nan,
29+
}
30+
31+
fig, ax = uplt.subplots(proj="robin", refwidth=4.6)
32+
33+
ax.choropleth(
34+
country_values,
35+
country=True,
36+
cmap="Fire",
37+
edgecolor="white",
38+
linewidth=0.6,
39+
colorbar="r",
40+
colorbar_kw={"label": "Index value"},
41+
missing_kw={"facecolor": "gray8", "hatch": "//", "edgecolor": "white"},
42+
)
43+
44+
ax.format(
45+
title="Country choropleth",
46+
ocean=True,
47+
oceancolor="ocean blue",
48+
coast=True,
49+
borders=True,
50+
lonlines=60,
51+
latlines=30,
52+
labels=False,
53+
)
54+
55+
fig.show()

docs/projections.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,35 @@
325325
)
326326

327327

328+
# %%
329+
import shapely.geometry as sgeom
330+
331+
fig, ax = uplt.subplots(proj="cyl", refwidth=3.5)
332+
ax.choropleth(
333+
[
334+
sgeom.box(-20, -10, -5, 5),
335+
sgeom.box(0, -5, 15, 10),
336+
sgeom.box(20, -8, 35, 8),
337+
],
338+
[1.2, 2.4, 0.7],
339+
cmap="Blues",
340+
edgecolor="white",
341+
linewidth=0.8,
342+
colorbar="r",
343+
colorbar_kw={"label": "value"},
344+
)
345+
ax.format(
346+
title="Polygon choropleth",
347+
land=True,
348+
coast=True,
349+
lonlim=(-30, 40),
350+
latlim=(-20, 20),
351+
labels=True,
352+
lonlines=10,
353+
latlines=10,
354+
)
355+
356+
328357
# %% [raw] raw_mimetype="text/restructuredtext"
329358
# .. _ug_geoformat:
330359
#

tools/release/publish_zenodo.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
import mimetypes
77
import os
88
import sys
9-
import tomllib
109
from pathlib import Path
1110
from urllib import error, parse, request
1211

12+
try:
13+
import tomllib
14+
except ModuleNotFoundError: # pragma: no cover
15+
import tomli as tomllib
16+
1317
try:
1418
import yaml
1519
except ImportError as exc: # pragma: no cover - exercised in release workflow

0 commit comments

Comments
 (0)