Skip to content

Commit d171e71

Browse files
Merge branch 'main' into rename-to-between_fill
2 parents d14c227 + 164d61d commit d171e71

130 files changed

Lines changed: 1214 additions & 364 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/api/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ All plotting is handled through the :class:`pygmt.Figure` class and its methods.
1818

1919
Figure
2020

21-
Plotting map elements
22-
~~~~~~~~~~~~~~~~~~~~~
21+
Plotting figure elements
22+
~~~~~~~~~~~~~~~~~~~~~~~~
2323

2424
.. autosummary::
2525
:toctree: generated
@@ -34,6 +34,7 @@ Plotting map elements
3434
Figure.legend
3535
Figure.logo
3636
Figure.magnetic_rose
37+
Figure.paragraph
3738
Figure.scalebar
3839
Figure.solar
3940
Figure.text

examples/gallery/3d_plots/scatter3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
fill=df.species.cat.codes.astype(int),
8080
# Use colormap created by makecpt
8181
cmap=True,
82-
# Set map dimensions (xmin, xmax, ymin, ymax, zmin, zmax)
82+
# Set plot dimensions (xmin, xmax, ymin, ymax, zmin, zmax)
8383
region=region,
8484
# Set frame parameters
8585
frame=Frame(

examples/gallery/embellishments/timestamp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import os
1313

1414
import pygmt
15+
from pygmt.params import Axis
1516

1617
fig = pygmt.Figure()
1718
fig.basemap(region=[20, 30, -10, 10], projection="X10c/5c", frame=True)
@@ -25,7 +26,13 @@
2526
os.environ["TZ"] = "Pacific/Honolulu" # optionally set the time zone
2627

2728
fig = pygmt.Figure()
28-
fig.coast(region="d", projection="H10c", land="black", water="cornsilk", frame="afg")
29+
fig.coast(
30+
region="d",
31+
projection="H10c",
32+
land="black",
33+
water="cornsilk",
34+
frame=Axis(annot=True, tick=True, grid=True),
35+
)
2936
fig.timestamp(
3037
label="Powered by PyGMT",
3138
justify="TL",

examples/gallery/images/contours.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
# %%
2424
import numpy as np
2525
import pygmt
26+
from pygmt.params import Axis
2627

2728
# Build the contours underlying data with the function z = x^2 + y^2
2829
X, Y = np.meshgrid(np.linspace(-10, 10, 50), np.linspace(-10, 10, 50))
@@ -34,7 +35,7 @@
3435
fig.contour(
3536
region=[-10, 10, -10, 10],
3637
projection="X10c/10c",
37-
frame="ag",
38+
frame=Axis(annot=True, grid=True),
3839
pen="0.5p",
3940
# Pass the data as 3 1-D data columns
4041
x=x,

examples/gallery/images/cross_section.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# %%
1616
import pygmt
17-
from pygmt.params import Box, Position
17+
from pygmt.params import Axis, Box, Frame, Position
1818

1919
# Define region of study area
2020
# lon_min, lon_max, lat_min, lat_max in degrees East and North
@@ -30,7 +30,7 @@
3030
# Bottom: Map of elevation in study area
3131

3232
# Set up basic map using a Mercator projection with a width of 12 centimeters
33-
fig.basemap(region=region_map, projection="M12c", frame="af")
33+
fig.basemap(region=region_map, projection="M12c", frame=Axis(annot=True, tick=True))
3434

3535
# Download grid for Earth relief with a resolution of 10 arc-minutes and gridline
3636
# registration [Default]
@@ -120,6 +120,12 @@
120120
# Add map frame
121121
# Add annotations ("a") and ticks ("f") as well as labels ("+l") at the west or left
122122
# and south or bottom sides ("WSrt")
123-
fig.basemap(frame=["WSrt", "xa2f1+lDistance+u°", "ya4000+lElevation / m"])
123+
fig.basemap(
124+
frame=Frame(
125+
axes="WSrt",
126+
xaxis=Axis(annot=2, tick=1, label="Distance", unit="°"),
127+
yaxis=Axis(annot=4000, label="Elevation / m"),
128+
)
129+
)
124130

125131
fig.show()

examples/gallery/images/grdclip.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# %%
1212
import pygmt
13-
from pygmt.params.position import Position
13+
from pygmt.params import Axis, Frame, Position
1414

1515
fig = pygmt.Figure()
1616

@@ -24,7 +24,12 @@
2424
fig.basemap(
2525
region=region,
2626
projection="M12c",
27-
frame=["WSne+toriginal grid", "xa5f1", "ya2f1"],
27+
frame=Frame(
28+
axes="WSne",
29+
title="original grid",
30+
xaxis=Axis(annot=5, tick=1),
31+
yaxis=Axis(annot=2, tick=1),
32+
),
2833
)
2934
fig.grdimage(grid=grid, cmap="SCM/oleron")
3035

@@ -39,7 +44,12 @@
3944
fig.basemap(
4045
region=region,
4146
projection="M12c",
42-
frame=["wSne+tclipped grid", "xa5f1", "ya2f1"],
47+
frame=Frame(
48+
axes="wSne",
49+
title="clipped grid",
50+
xaxis=Axis(annot=5, tick=1),
51+
yaxis=Axis(annot=2, tick=1),
52+
),
4353
)
4454
fig.grdimage(grid=grid)
4555
fig.colorbar(

examples/gallery/images/grdgradient.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

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

1818
# Define region of interest around Yosemite valley
1919
region = [-119.825, -119.4, 37.6, 37.825]
@@ -35,7 +35,12 @@
3535
fig.grdimage(
3636
grid=grid,
3737
projection="M12c",
38-
frame=["WSrt+tOriginal Data Elevation Model", "xa0.1", "ya0.1"],
38+
frame=Frame(
39+
axes="WSrt",
40+
title="Original Data Elevation Model",
41+
xaxis=Axis(annot=0.1),
42+
yaxis=Axis(annot=0.1),
43+
),
3944
cmap=True,
4045
)
4146
fig.colorbar(
@@ -57,7 +62,9 @@
5762
fig.grdimage(
5863
grid=dgrid,
5964
projection="M12c",
60-
frame=["lSEt+tHillshade Map", "xa0.1", "ya0.1"],
65+
frame=Frame(
66+
axes="lSEt", title="Hillshade Map", xaxis=Axis(annot=0.1), yaxis=Axis(annot=0.1)
67+
),
6168
cmap=True,
6269
)
6370

examples/gallery/images/grdgradient_shading.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
# %%
2424
import pygmt
25-
from pygmt.params import Position
25+
from pygmt.params import Axis, Frame, Position
2626

2727
# Load the 3 arc-minutes global relief grid in the target area around Caucasus
2828
grid = pygmt.datasets.load_earth_relief(resolution="03m", region=[35, 50, 35, 45])
@@ -58,10 +58,10 @@
5858
grid=grid,
5959
shading=shade,
6060
projection="M?",
61-
frame=[
62-
"a4f2",
63-
f"+tazimuth={azi}, normalize={normalize}, amp={amp}",
64-
],
61+
frame=Frame(
62+
title=f"azimuth={azi}, normalize={normalize}, amp={amp}",
63+
axis=Axis(annot=4, tick=2),
64+
),
6565
cmap=True,
6666
panel=True,
6767
)

examples/gallery/images/rgb_image.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# %%
1919
import pygmt
2020
import rioxarray
21+
from pygmt.params import Axis, Frame
2122

2223
# %%
2324
# Read 3-band data from GeoTIFF into an xarray.DataArray object:
@@ -38,6 +39,10 @@
3839
grid=image,
3940
# Use a map scale where 1 cm on the map equals 1 km on the ground
4041
projection="x1:100000",
41-
frame=[r"WSne+tL@!a¯hain@!a¯, Hawai`i on 9 Aug 2023", "af"],
42+
frame=Frame(
43+
axes="WSne",
44+
title=r"L@!a¯hain@!a¯, Hawai`i on 9 Aug 2023",
45+
axis=Axis(annot=True, tick=True),
46+
),
4247
)
4348
fig.show()

examples/gallery/lines/connection_lines.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
# %%
1313
import pygmt
14+
from pygmt.params import Axis, Frame
1415

1516
# Set up same sample data
1617
x = [2.2, 3.3, -3.1, -3.7, -0.1]
@@ -21,7 +22,11 @@
2122

2223
# -----------------------------------------------------------------------------
2324
# Left: record order
24-
fig.basemap(region=[-5, 5, -5, 5], projection="X6c", frame=["WSne", "af"])
25+
fig.basemap(
26+
region=[-5, 5, -5, 5],
27+
projection="X6c",
28+
frame=Frame(axes="WSne", axis=Axis(annot=True, tick=True)),
29+
)
2530

2631
# Connect data points based on the record order [Default connection=None]
2732
fig.plot(x=x, y=y, pen="1.5p,dodgerblue")
@@ -32,7 +37,11 @@
3237

3338
# -----------------------------------------------------------------------------
3439
# Middle: network
35-
fig.basemap(region=[-5, 5, -5, 5], projection="X6c", frame=["wSne", "af"])
40+
fig.basemap(
41+
region=[-5, 5, -5, 5],
42+
projection="X6c",
43+
frame=Frame(axes="wSne", axis=Axis(annot=True, tick=True)),
44+
)
3645

3746
# Connect data points as network
3847
fig.plot(x=x, y=y, pen="1.5p,dodgerblue", connection="n")
@@ -43,7 +52,11 @@
4352

4453
# -----------------------------------------------------------------------------
4554
# Right: reference point
46-
fig.basemap(region=[-5, 5, -5, 5], projection="X6c", frame=["wSne", "af"])
55+
fig.basemap(
56+
region=[-5, 5, -5, 5],
57+
projection="X6c",
58+
frame=Frame(axes="wSne", axis=Axis(annot=True, tick=True)),
59+
)
4760

4861
# Connect data points with the reference point (0,0)
4962
fig.plot(x=x, y=y, pen="1.5p,dodgerblue", connection="p0/0")

0 commit comments

Comments
 (0)