Skip to content

Commit cc7e18e

Browse files
Figure.meca: Deprecate parameters compressionfill/extensionfill to compression_fill/extension_fill (Will be removed in v0.20.0) (#4269)
1 parent e8cd1e3 commit cc7e18e

File tree

4 files changed

+33
-27
lines changed

4 files changed

+33
-27
lines changed

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/symbols/patterns.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
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``

examples/tutorials/advanced/focal_mechanisms.py

Lines changed: 10 additions & 10 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()

pygmt/src/meca.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from pygmt.helpers import (
1515
build_arg_list,
1616
data_kind,
17+
deprecate_parameter,
1718
fmt_docstring,
1819
use_alias,
1920
)
@@ -115,12 +116,18 @@ def _auto_offset(spec) -> bool:
115116

116117

117118
@fmt_docstring
119+
@deprecate_parameter(
120+
"extensionfill", "extension_fill", "v0.18.0", remove_version="v0.20.0"
121+
)
122+
@deprecate_parameter(
123+
"compressionfill", "compression_fill", "v0.18.0", remove_version="v0.20.0"
124+
)
118125
@use_alias(
119126
A="offset",
120127
C="cmap",
121-
E="extensionfill",
128+
E="extension_fill",
122129
Fr="labelbox",
123-
G="compressionfill",
130+
G="compression_fill",
124131
L="outline",
125132
T="nodal",
126133
W="pen",
@@ -302,12 +309,12 @@ def meca( # noqa: PLR0913
302309
is drawn. Use **+s**\ *size* to plot a small circle at the initial location and
303310
to set the diameter of this circle [Default is no circle]. Use **+p**\ *pen* to
304311
set the pen attributes for this feature [Default is set via ``pen``]. The fill
305-
of the circle is set via ``compressionfill`` or ``cmap``, i.e., corresponds to
312+
of the circle is set via ``compression_fill`` or ``cmap``, i.e., corresponds to
306313
the fill of the compressive quadrants.
307-
compressionfill : str
314+
compression_fill : str
308315
Set color or pattern for filling compressive quadrants [Default is ``"black"``].
309316
This setting also applies to the fill of the circle defined via ``offset``.
310-
extensionfill : str
317+
extension_fill : str
311318
Set color or pattern for filling extensive quadrants [Default is ``"white"``].
312319
pen : str
313320
Set (default) pen attributes for all lines related to the beachball [Default is

0 commit comments

Comments
 (0)