Skip to content

Commit 1b4b78d

Browse files
authored
Merge branch 'main' into refactor/legend
2 parents ebe510e + b4a94d7 commit 1b4b78d

File tree

19 files changed

+183
-140
lines changed

19 files changed

+183
-140
lines changed

examples/gallery/images/grdlandmask.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
==========================
44
55
The :func:`pygmt.grdlandmask` function allows setting all nodes on land
6-
or water to a specified value using the ``maskvalues`` parameter.
6+
or water to a specified value using the ``mask_values`` parameter.
77
"""
88

99
# %%
@@ -18,7 +18,9 @@
1818
# masses.
1919
# Use shoreline data with (l)ow resolution and set the grid spacing to
2020
# 5 arc-minutes in x- and y-directions.
21-
grid = pygmt.grdlandmask(region=region, spacing="5m", maskvalues=[0, 1], resolution="l")
21+
grid = pygmt.grdlandmask(
22+
region=region, spacing="5m", mask_values=[0, 1], resolution="l"
23+
)
2224

2325
# Plot clipped grid
2426
fig.basemap(region=region, projection="M12c", frame=True)

examples/gallery/lines/wiggle.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
tracks. ``x``, ``y``, ``z`` can be specified as 1-D arrays or within a
77
specified file. The ``scale`` parameter can be used to set the scale of the
88
anomaly in data/distance units. The positive and/or negative areas can be
9-
filled with color by setting the ``fillpositive`` and/or ``fillnegative``
9+
filled with color by setting the ``positive_fill`` and/or ``negative_fill``
1010
parameters.
1111
"""
1212

@@ -28,9 +28,9 @@
2828
# Set anomaly scale to 20 centimeters
2929
scale="20c",
3030
# Fill positive areas red
31-
fillpositive="red",
31+
positive_fill="red",
3232
# Fill negative areas gray
33-
fillnegative="gray",
33+
negative_fill="gray",
3434
# Set the outline width to 1.0 point
3535
pen="1.0p",
3636
# Draw a blue track with a width of 0.5 points

examples/gallery/seismology/meca.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
Focal mechanisms
33
================
44
5-
The :meth:`pygmt.Figure.meca` method can plot focal mechanisms or beachballs.
6-
We can specify the focal mechanism nodal planes or moment tensor components
7-
as a dictionary using the ``spec`` parameter (or they can be specified as a
8-
1-D or 2-D array, or within a file). The size of the beachballs can be set
9-
using the ``scale`` parameter. The compressive and extensive quadrants can
10-
be filled either with a color or a pattern via the ``compressionfill`` and
11-
``extensionfill`` parameters, respectively. Use the ``pen`` parameter to
12-
adjust the outline of the beachballs.
5+
The :meth:`pygmt.Figure.meca` method can plot focal mechanisms or beachballs. We can
6+
specify the focal mechanism nodal planes or moment tensor components as a dictionary
7+
using the ``spec`` parameter (or they can be specified as a 1-D or 2-D array, or within
8+
a file). The size of the beachballs can be set using the ``scale`` parameter. The
9+
compressive and extensive quadrants can be filled either with a color or a pattern via
10+
the ``compression_fill`` and ``extension_fill`` parameters, respectively. Use the
11+
``pen`` parameter to adjust the outline of the beachballs.
1312
"""
1413

1514
# %%
@@ -41,10 +40,10 @@
4140
depth=12.0,
4241
# Fill compressive quadrants with color "red"
4342
# [Default is "black"]
44-
compressionfill="red",
43+
compression_fill="red",
4544
# Fill extensive quadrants with color "cornsilk"
4645
# [Default is "white"]
47-
extensionfill="cornsilk",
46+
extension_fill="cornsilk",
4847
# Draw a 0.5-point thick dark gray ("gray30") solid outline via
4948
# the pen parameter [Default is "0.25p,black,solid"]
5049
pen="0.5p,gray30,solid",

examples/gallery/seismology/velo_arrow_ellipse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
projection="x0.8c",
3434
frame=["WSne", "2g2f"],
3535
spec="e0.2/0.39+f18",
36-
uncertaintyfill="lightblue1",
36+
uncertainty_fill="lightblue1",
3737
pen="0.6p,red",
3838
line=True,
3939
vector="0.3c+p1p+e+gred",

examples/gallery/symbols/patterns.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
1010
- :meth:`pygmt.Figure.coast`: Land and water masses via ``land`` and ``water``
1111
- :meth:`pygmt.Figure.histogram`: Histogram bars via ``fill``
12-
- :meth:`pygmt.Figure.meca`: Focal mechanisms via ``compressionfill`` and
13-
``extensionfill``
12+
- :meth:`pygmt.Figure.meca`: Focal mechanisms via ``compression_fill`` and
13+
``extension_fill``
1414
- :meth:`pygmt.Figure.plot`: Symbols and polygons via ``fill``
1515
- :meth:`pygmt.Figure.rose`: Histogram sectors via ``fill``
1616
- :meth:`pygmt.Figure.solar`: Day-light terminators via ``fill``
1717
- :meth:`pygmt.Figure.ternary`: Symbols via ``fill``
1818
- :meth:`pygmt.Figure.velo`: Uncertainty wedges and velocity error ellipses via
19-
``uncertaintyfill``
20-
- :meth:`pygmt.Figure.wiggle`: Anomalies via ``fillpositive`` and ``fillnegative``
19+
``uncertainty_fill``
20+
- :meth:`pygmt.Figure.wiggle`: Anomalies via ``positive_fill`` and ``negative_fill``
2121
2222
GMT provides 90 predefined 1-bit patterns, which are numbered from 1 to 90. In addition,
2323
custom 1-, 8-, or 24-bit image raster files can also be used as patterns.

examples/tutorials/advanced/draping_on_3d_surface.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
==================================================
44
55
It can be visually appealing to "drape" a dataset over a topographic surface. This can
6-
be accomplished using the ``drapegrid`` parameter of :meth:`pygmt.Figure.grdview`.
6+
be accomplished using the ``drape_grid`` parameter of :meth:`pygmt.Figure.grdview`.
77
88
This tutorial consists of two examples:
99
@@ -41,9 +41,9 @@
4141
# The topographic surface is created based on the grid passed to the ``grid`` parameter
4242
# of :meth:`pygmt.Figure.grdview`; here we use a grid of the Earth relief. To add a
4343
# color-coding based on *another* grid we have to pass a second grid to the
44-
# ``drapegrid`` parameter; here we use a grid of the crustal age. In this case the
44+
# ``drape_grid`` parameter; here we use a grid of the crustal age. In this case the
4545
# colormap specified via the ``cmap`` parameter applies to the grid passed to
46-
# ``drapegrid``, not to ``grid``. The azimuth and elevation of the 3-D plot are set via
46+
# ``drape_grid``, not to ``grid``. The azimuth and elevation of the 3-D plot are set via
4747
# the ``perspective`` parameter.
4848

4949
fig = pygmt.Figure()
@@ -56,7 +56,7 @@
5656
projection="M12c", # Mercator projection with a width of 12 centimeters
5757
region=region_3d,
5858
grid=grd_relief, # Use elevation grid for z values
59-
drapegrid=grd_age, # Use crustal age grid for color-coding
59+
drape_grid=grd_age, # Use crustal age grid for color-coding
6060
cmap=True, # Use colormap created for the crustal age
6161
surftype="i", # Create an image plot
6262
# Use an illumination from the azimuthal directions 0° (north) and 270°
@@ -101,12 +101,12 @@
101101
url_to_image = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Flag_of_Europe.svg/1000px-Flag_of_Europe.svg.png"
102102
with rasterio.open(url_to_image) as dataset:
103103
data = dataset.read()
104-
drapegrid = xr.DataArray(data, dims=("band", "y", "x"))
104+
drape_grid = xr.DataArray(data, dims=("band", "y", "x"))
105105

106106
# %%
107107
# Again we create a 3-D plot with :meth:`pygmt.Figure.grdview` and pass an Earth relief
108108
# grid to the ``grid`` parameter to create the topographic surface. But now we pass the
109-
# PNG image which was loaded into an :class:`xarray.DataArray` to the ``drapgrid``
109+
# PNG image which was loaded into an :class:`xarray.DataArray` to the ``drape_grid``
110110
# parameter.
111111

112112
fig = pygmt.Figure()
@@ -120,7 +120,7 @@
120120
projection="M12c", # Mercator projection with a width of 12 centimeters
121121
region=region_3d,
122122
grid=grd_relief, # Use elevation grid for z values
123-
drapegrid=drapegrid, # Drap image grid for the EU flag on top
123+
drape_grid=drape_grid, # Drape image grid for the EU flag on top
124124
cmap=True, # Use colormap defined for the EU flag
125125
surftype="i", # Create an image plot
126126
# Use an illumination from the azimuthal directions 0° (north) and 270° (west) with

examples/tutorials/advanced/focal_mechanisms.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
# Filling the quadrants
100100
# ---------------------
101101
#
102-
# Use the parameters ``compressionfill`` and ``extensionfill`` to fill the quadrants
102+
# Use the parameters ``compression_fill`` and ``extension_fill`` to fill the quadrants
103103
# with different colors or :class:`patterns <pygmt.params.Pattern>`.
104104
fig = pygmt.Figure()
105105
fig.basemap(region=region, projection=projection, frame=frame)
@@ -110,8 +110,8 @@
110110
longitude=-2,
111111
latitude=0,
112112
depth=0,
113-
compressionfill="darkorange",
114-
extensionfill="cornsilk",
113+
compression_fill="darkorange",
114+
extension_fill="cornsilk",
115115
)
116116

117117
fig.meca(
@@ -120,8 +120,8 @@
120120
longitude=2,
121121
latitude=0,
122122
depth=0,
123-
compressionfill=Pattern(8),
124-
extensionfill=Pattern(31),
123+
compression_fill=Pattern(8),
124+
extension_fill=Pattern(31),
125125
outline=True,
126126
)
127127

@@ -168,8 +168,8 @@
168168
# both, ``"1"`` to the first, and ``"2"`` to the second nodal plane(s). Only the
169169
# circumference and the specified nodal plane(s) are plotted, i.e. the quadrants
170170
# remain unfilled (transparent). We can make use of the stacking concept of (Py)GMT,
171-
# and use ``nodal`` in combination with the ``outline``, ``compressionfill`` /
172-
# ``extensionfill`` and ``pen`` parameters.
171+
# and use ``nodal`` in combination with the ``outline``, ``compression_fill`` /
172+
# ``extension_fill`` and ``pen`` parameters.
173173

174174
fig = pygmt.Figure()
175175
fig.basemap(region=region, projection=projection, frame=frame)
@@ -188,9 +188,9 @@
188188
# (ii) Plot the first nodal plane and the circumference in darkorange
189189
# (iii) Plot the circumference in black on top; use "-" to not fill the quadrants
190190
for kwargs in [
191-
{"compressionfill": "lightorange"},
191+
{"compression_fill": "lightorange"},
192192
{"nodal": "1/1p,darkorange"},
193-
{"compressionfill": "-", "extensionfill": "-", "pen": "1p,gray30"},
193+
{"compression_fill": "-", "extension_fill": "-", "pen": "1p,gray30"},
194194
]:
195195
fig.meca(
196196
spec=aki_single,
@@ -238,7 +238,7 @@
238238
plot_longitude=1,
239239
plot_latitude=2,
240240
offset="+p1p,darkorange+s0.25c",
241-
compressionfill="lightorange",
241+
compression_fill="lightorange",
242242
)
243243

244244
fig.show()
@@ -284,13 +284,13 @@
284284
# parameter. Additionally, the location of the label relative to the beachball [Default
285285
# is ``"TC"``, i.e., Top Center] can be changed by appending **+j** and an offset can
286286
# be applied by appending **+o** with values for *dx*\ /*dy*. Add a colored [Default is
287-
# white] box behind the label via the label ``labelbox``. Force a fixed size of the
287+
# white] box behind the label via the parameter ``label_box``. Force a fixed size of the
288288
# beachball by appending **+m** to the argument passed to the ``scale`` parameter.
289289

290290
fig = pygmt.Figure()
291291
fig.coast(region="d", projection="N10c", land="lightgray", frame=True)
292292

293-
fig.meca(spec=aki_multiple, scale="0.4c+m+f5p", labelbox="white@30", offset="+s0.1c")
293+
fig.meca(spec=aki_multiple, scale="0.4c+m+f5p", label_box="white@30", offset="+s0.1c")
294294

295295
fig.show()
296296

@@ -315,7 +315,7 @@
315315
spec=aki_multiple,
316316
scale="0.4c+f5p",
317317
offset="0.2p,gray30+s0.1c",
318-
labelbox="white@30",
318+
label_box="white@30",
319319
cmap=True,
320320
outline="0.2p,gray30",
321321
)

0 commit comments

Comments
 (0)