Skip to content

Commit 8adb6a4

Browse files
authored
Merge branch 'main' into feature/paragraph
2 parents 288ca34 + 7b7a349 commit 8adb6a4

14 files changed

Lines changed: 94 additions & 54 deletions

File tree

.github/workflows/benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484

8585
# Run the benchmark tests
8686
- name: Run benchmarks
87-
uses: CodSpeedHQ/action@281164b0f014a4e7badd2c02cecad9b595b70537 # v4.11.1
87+
uses: CodSpeedHQ/action@d872884a306dd4853acf0f584f4b706cf0cc72a2 # v4.13.0
8888
with:
8989
mode: "instrumentation"
9090
# 'bash -el -c' is needed to use the custom shell.

.github/workflows/ci_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
GH_TOKEN: ${{ github.token }}
155155

156156
- name: Install uv
157-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
157+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
158158
with:
159159
activate-environment: true
160160
python-version: ${{ matrix.python-version }}

.github/workflows/dvc-diff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
uses: iterative/setup-dvc@175771be1dc3d119268e00a896b52a4b77decb5e # v1.2.0
3737

3838
- name: Setup continuous machine learning (CML)
39-
uses: iterative/setup-cml@f714cd201b7183852dd6f94192b34e7618717560 # v2.0.0
39+
uses: iterative/setup-cml@1b5ab8766e715e8f1aab96bbb1f4f2e3e1e8af45 # v3
4040

4141
# Produce the markdown diff report, which should look like:
4242
# ## Summary of changed images

examples/gallery/3d_plots/grdview_surface.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@
55
The :meth:`pygmt.Figure.grdview()` method can plot 3-D surfaces with
66
``surftype="surface"``. Here, we supply the data as an :class:`xarray.DataArray` with
77
the coordinate vectors ``x`` and ``y`` defined. Note that the ``perspective`` parameter
8-
here controls the azimuth and elevation angle of the view. We provide a list of two
9-
arguments to ``frame`` - the first argument specifies the :math:`x`- and :math:`y`-axes
10-
frame attributes and the second argument, prepended with ``"z"``, specifies the
11-
:math:`z`-axis frame attributes. Specifying the same scale for the ``projection`` and
12-
``zscale`` parameters ensures equal axis scaling. The ``shading`` parameter specifies
13-
illumination; here we choose an azimuth of 45° with ``shading="+a45"``.
8+
here controls the azimuth and elevation angle of the view. Specifying the same scale
9+
for the ``projection`` and ``zscale`` parameters ensures equal axis scaling. The
10+
``shading`` parameter specifies illumination; here we choose an azimuth of 45° with
11+
``shading="+a45"``.
1412
"""
1513

1614
# %%
1715
import numpy as np
1816
import pygmt
1917
import xarray as xr
20-
from pygmt.params import Position
18+
from pygmt.params import Axis, Frame, Position
2119

2220

2321
# Define an interesting function of two variables, see:
@@ -47,7 +45,10 @@ def ackley(x, y):
4745
fig.grdview(
4846
data,
4947
# Set annotations and gridlines in steps of five, and tick marks in steps of one
50-
frame=["a5f1g5", "za5f1g5"],
48+
frame=Frame(
49+
axis=Axis(annot=5, tick=1, grid=5), # x and y axes
50+
zaxis=Axis(annot=5, tick=1, grid=5),
51+
),
5152
projection=f"x{SCALE}c",
5253
zscale=f"{SCALE}c",
5354
surftype="surface",

examples/gallery/3d_plots/scatter3d.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
parameter has to include the :math:`x`, :math:`y`, :math:`z` axis limits in the
1010
form of (xmin, xmax, ymin, ymax, zmin, zmax), which can be done automatically
1111
using :func:`pygmt.info`. To plot the z-axis frame, set ``frame`` as a
12-
minimum to something like ``frame=["WsNeZ", "zaf"]``. Use ``perspective`` to
12+
minimum to something like ``Frame(axes="WsNeZ", zaxis=Axis(annot=True, tick=True))``.
13+
Use ``perspective`` to
1314
control the azimuth and elevation angle of the view, and ``zscale`` to adjust
1415
the vertical exaggeration factor.
1516
"""
1617

1718
# %%
1819
import pandas as pd
1920
import pygmt
21+
from pygmt.params import Axis, Frame
2022

2123
# Load sample iris data
2224
df = pd.read_csv("https://github.com/mwaskom/seaborn-data/raw/master/iris.csv")
@@ -80,12 +82,13 @@
8082
# Set map dimensions (xmin, xmax, ymin, ymax, zmin, zmax)
8183
region=region,
8284
# Set frame parameters
83-
frame=[
84-
"WsNeZ3+tIris flower data set", # z axis label positioned on 3rd corner, add title
85-
"xafg+lPetal Width (cm)",
86-
"yafg+lSepal Length (cm)",
87-
"zafg+lPetal Length (cm)",
88-
],
85+
frame=Frame(
86+
axes="WsNeZ3", # z axis label positioned on 3rd corner
87+
title="Iris flower data set",
88+
xaxis=Axis(annot=True, tick=True, grid=True, label="Petal Width (cm)"),
89+
yaxis=Axis(annot=True, tick=True, grid=True, label="Sepal Length (cm)"),
90+
zaxis=Axis(annot=True, tick=True, grid=True, label="Petal Length (cm)"),
91+
),
8992
# Set perspective to azimuth NorthWest (315°), at elevation 25°
9093
perspective=[315, 25],
9194
# Vertical exaggeration factor

examples/gallery/basemaps/double_y_axes.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class can control which axes should be plotted and optionally show annotations,
2020
# %%
2121
import numpy as np
2222
import pygmt
23-
from pygmt.params import Position
23+
from pygmt.params import Axis, Frame, Position
2424

2525
# Generate two sample Y-data from one common X-data
2626
x = np.linspace(1.0, 9.0, num=9)
@@ -33,7 +33,11 @@ class can control which axes should be plotted and optionally show annotations,
3333
# The bottom axis (S) is plotted with annotations and tick marks
3434
# The top axis (t) is plotted without annotations and tick marks
3535
# The left and right axes are not drawn
36-
fig.basemap(region=[0, 10, 0, 10], projection="X15c/15c", frame=["St", "xaf+lx"])
36+
fig.basemap(
37+
region=[0, 10, 0, 10],
38+
projection="X15c/15c",
39+
frame=Frame(axes="St", xaxis=Axis(annot=True, tick=True, label="x")),
40+
)
3741

3842
# Plot the Y-axis for y1-data
3943
# The left axis (W) is plotted with blue annotations, ticks, and label
@@ -43,7 +47,7 @@ class can control which axes should be plotted and optionally show annotations,
4347
FONT_ANNOT_PRIMARY="blue",
4448
FONT_LABEL="blue",
4549
):
46-
fig.basemap(frame=["W", "yaf+ly1"])
50+
fig.basemap(frame=Frame(axes="W", yaxis=Axis(annot=True, tick=True, label="y1")))
4751

4852
# Plot the line for y1-data
4953
fig.plot(x=x, y=y1, pen="1p,blue")
@@ -58,7 +62,10 @@ class can control which axes should be plotted and optionally show annotations,
5862
FONT_ANNOT_PRIMARY="red",
5963
FONT_LABEL="red",
6064
):
61-
fig.basemap(region=[0, 10, 100, 200], frame=["E", "yaf+ly2"])
65+
fig.basemap(
66+
region=[0, 10, 100, 200],
67+
frame=Frame(axes="E", yaxis=Axis(annot=True, tick=True, label="y2")),
68+
)
6269
# Plot the line for y2-data
6370
fig.plot(x=x, y=y2, pen="1p,red")
6471
# Plot points for y2-data

examples/gallery/embellishments/colorbar.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313

1414
# %%
1515
import pygmt
16-
from pygmt.params import Position
16+
from pygmt.params import Axis, Frame, Position
1717

1818
fig = pygmt.Figure()
19-
fig.basemap(region=[0, 3, 6, 9], projection="x3c", frame=["af", "WSne+tColorbars"])
19+
fig.basemap(
20+
region=[0, 3, 6, 9],
21+
projection="x3c",
22+
frame=Frame(axes="WSne", title="Colorbars", axis=Axis(annot=True, tick=True)),
23+
)
2024

2125
# ============
2226
# Create a colorbar designed for seismic tomography - roma

examples/gallery/embellishments/colorbars_multiple.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# %%
1212
import pygmt
13+
from pygmt.params import Axis
1314

1415
fig = pygmt.Figure()
1516

@@ -28,15 +29,17 @@
2829
pygmt.makecpt(cmap="gmt/geo", series=[-8000, 8000])
2930
# "R?" means Winkel Tripel projection with map width automatically determined
3031
# from the subplot width.
31-
fig.grdimage(grid=grid_globe, projection="R?", region="g", frame="a")
32+
fig.basemap(projection="R?", region="g", frame=Axis(annot=True))
33+
fig.grdimage(grid=grid_globe)
3234
fig.colorbar(annot=4000, tick=2000, label="Elevation", unit="m")
3335
# Activate the second panel so that the colormap created by the makecpt function is
3436
# a panel-level CPT
3537
with fig.set_panel(panel=1):
3638
pygmt.makecpt(cmap="gmt/globe", series=[-6000, 3000])
3739
# "M?" means Mercator projection with map width also automatically determined
3840
# from the subplot width.
39-
fig.grdimage(grid=grid_subset, projection="M?", region=subset_region, frame="a")
41+
fig.basemap(projection="M?", region=subset_region, frame=Axis(annot=True))
42+
fig.grdimage(grid=grid_subset)
4043
fig.colorbar(annot=2000, tick=1000, label="Elevation", unit="m")
4144

4245
fig.show()

examples/gallery/embellishments/inset.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,28 @@
99

1010
# %%
1111
import pygmt
12-
from pygmt.params import Box, Position
12+
from pygmt.params import Axis, Box, Position
1313

1414
fig = pygmt.Figure()
15-
# Create the primary figure, setting the region to Madagascar, the land color to
16-
# "brown", the water to "lightblue", the shorelines width to "thin", and adding a frame
17-
fig.coast(region="MG+r2", land="brown", water="lightblue", shorelines="thin", frame="a")
18-
# Create an inset, placing it in the Top Left (TL) corner with a width of 3.5 cm and
19-
# x- and y-offsets of 0.2 cm. The clearance is set to 0, and the border is "gold" with a
15+
# Create the primary figure, setting the region to Madagascar
16+
fig.basemap(region="MG+r2", projection="M12c", frame=Axis(annot=True))
17+
# Set the land color to "brown", the water color to "lightblue", and the shorelines
18+
# width to "thin"
19+
fig.coast(land="brown", water="lightblue", shorelines="thin")
20+
21+
# Create an inset, placing it in the Top Left (TL) corner with a width of 3.5 cm and x-
22+
# and y-offsets of 0.2 cm. The clearance is set to 0, and the border is "gold" with a
2023
# pen thickness of 1.5 points.
2124
with fig.inset(
2225
position=Position("TL", offset=0.2),
2326
width=3.5,
2427
clearance=0,
2528
box=Box(pen="1.5p,gold"),
2629
):
27-
# Create a figure in the inset using coast. This example uses the azimuthal
28-
# orthogonal projection centered at 47E, 20S. The land color is set to "gray" and
29-
# Madagascar is highlighted in "red3".
30-
fig.coast(
31-
region="g", projection="G47/-20/?", land="gray", water="white", dcw="MG+gred3"
32-
)
30+
# Create a map within the inset. This example uses the azimuthal orthogonal
31+
# projection centered at 47 E, 20 S. The question mark is required for the
32+
# automatic size determination by PyGMT
33+
fig.basemap(region="g", projection="G47/-20/?", frame=0)
34+
# Madagascar is highlighted in "red3"
35+
fig.coast(land="gray", water="white", dcw="MG+gred3")
3336
fig.show()

examples/gallery/embellishments/inset_rectangle_region.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@
99

1010
# %%
1111
import pygmt
12-
from pygmt.params import Box, Position
12+
from pygmt.params import Axis, Box, Frame, Position
1313

1414
# Set the region of the main figure
1515
region = [137.5, 141, 34, 37]
1616

1717
fig = pygmt.Figure()
1818
# Plot the base map of the main figure. Universal Transverse Mercator (UTM) projection
1919
# is used and the UTM zone is set to be "54S".
20-
fig.basemap(region=region, projection="U54S/12c", frame=["WSne", "af"])
20+
fig.basemap(
21+
region=region,
22+
projection="U54S/12c",
23+
frame=Frame(axes="WSne", axis=Axis(annot=True, tick=True)),
24+
)
2125

2226
# Set the land color to "lightbrown", the water color to "azure1", the shoreline width
2327
# to "2p", and the area threshold to 1000 km^2 for the main figure.

0 commit comments

Comments
 (0)