Skip to content

Commit e656013

Browse files
Figure.wiggle: Deprecate parameters fillnegative/fillpositive to negative_fill/positive_fill (Will be removed in v0.20.0) (#4271)
1 parent a95862d commit e656013

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- :meth:`pygmt.Figure.ternary`: Symbols via ``fill``
1818
- :meth:`pygmt.Figure.velo`: Uncertainty wedges and velocity error ellipses via
1919
``uncertaintyfill``
20-
- :meth:`pygmt.Figure.wiggle`: Anomalies via ``fillpositive`` and ``fillnegative``
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.

pygmt/src/wiggle.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
from pygmt._typing import PathLike, TableLike
99
from pygmt.alias import Alias, AliasSystem
1010
from pygmt.clib import Session
11-
from pygmt.helpers import build_arg_list, fmt_docstring, use_alias
11+
from pygmt.helpers import build_arg_list, deprecate_parameter, fmt_docstring, use_alias
1212

1313

14-
def _parse_fills(fillpositive, fillnegative):
14+
def _parse_fills(positive_fill, negative_fill):
1515
"""
16-
Parse the fillpositive and fillnegative parameters.
16+
Parse the positive_fill and negative_fill parameters.
1717
1818
>>> _parse_fills("red", "blue")
1919
['red+p', 'blue+n']
@@ -24,10 +24,10 @@ def _parse_fills(fillpositive, fillnegative):
2424
>>> _parse_fills(None, None)
2525
"""
2626
_fills = []
27-
if fillpositive is not None:
28-
_fills.append(fillpositive + "+p")
29-
if fillnegative is not None:
30-
_fills.append(fillnegative + "+n")
27+
if positive_fill is not None:
28+
_fills.append(positive_fill + "+p")
29+
if negative_fill is not None:
30+
_fills.append(negative_fill + "+n")
3131

3232
match len(_fills):
3333
case 0:
@@ -39,6 +39,12 @@ def _parse_fills(fillpositive, fillnegative):
3939

4040

4141
@fmt_docstring
42+
@deprecate_parameter(
43+
"fillpositive", "positive_fill", "v0.18.0", remove_version="v0.20.0"
44+
)
45+
@deprecate_parameter(
46+
"fillnegative", "negative_fill", "v0.18.0", remove_version="v0.20.0"
47+
)
4248
@use_alias(
4349
D="position",
4450
T="track",
@@ -58,8 +64,8 @@ def wiggle( # noqa: PLR0913
5864
x=None,
5965
y=None,
6066
z=None,
61-
fillpositive=None,
62-
fillnegative=None,
67+
positive_fill=None,
68+
negative_fill=None,
6369
projection: str | None = None,
6470
region: Sequence[float | str] | str | None = None,
6571
frame: str | Sequence[str] | bool = False,
@@ -83,7 +89,7 @@ def wiggle( # noqa: PLR0913
8389
8490
$aliases
8591
- B = frame
86-
- G = **+p**: fillpositive, **+n**: fillnegative
92+
- G = **+p**: positive_fill, **+n**: negative_fill
8793
- J = projection
8894
- R = region
8995
- V = verbose
@@ -114,9 +120,9 @@ def wiggle( # noqa: PLR0913
114120
**+w**\ *length*\ [**+j**\ *justify*]\ [**+al**\|\ **r**]\
115121
[**+o**\ *dx*\ [/*dy*]][**+l**\ [*label*]].
116122
Define the reference point on the map for the vertical scale bar.
117-
fillpositive : str
123+
positive_fill : str
118124
Set color or pattern for filling positive wiggles [Default is no fill].
119-
fillnegative : str
125+
negative_fill : str
120126
Set color or pattern for filling negative wiggles [Default is no fill].
121127
track : str
122128
Draw track [Default is no track]. Append pen attributes to use
@@ -138,10 +144,10 @@ def wiggle( # noqa: PLR0913
138144
"""
139145
self._activate_figure()
140146

141-
_fills = _parse_fills(fillpositive, fillnegative)
147+
_fills = _parse_fills(positive_fill, negative_fill)
142148

143149
aliasdict = AliasSystem(
144-
G=Alias(_fills, name="fillpositive/fillnegative"),
150+
G=Alias(_fills, name="positive_fill/negative_fill"),
145151
).add_common(
146152
B=frame,
147153
J=projection,

pygmt/tests/test_wiggle.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def test_wiggle():
2424
y=y,
2525
z=z,
2626
scale="0.5c",
27-
fillpositive="red",
28-
fillnegative="gray",
27+
positive_fill="red",
28+
negative_fill="gray",
2929
pen="1.0p",
3030
track="0.5p",
3131
position="jRM+w2+lnT",
@@ -54,8 +54,8 @@ def test_wiggle_data_incols():
5454
projection="X8c",
5555
incols=[1, 0, 2],
5656
scale="0.5c",
57-
fillpositive="red",
58-
fillnegative="gray",
57+
positive_fill="red",
58+
negative_fill="gray",
5959
pen="1.0p",
6060
track="0.5p",
6161
position="jRM+w2+lnT",

0 commit comments

Comments
 (0)