GeezerVison is showing github.com — Figure.wiggle: Deprecate parameters fillnegative/fillpositive to nega… · GenericMappingTools/pygmt@e656013
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: examples/gallery/lines/wiggle.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | tracks. ``x``, ``y``, ``z`` can be specified as 1-D arrays or within a | 7 | 7 | specified file. The ``scale`` parameter can be used to set the scale of the | 8 | 8 | 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`` | 10 | 10 | parameters. | 11 | 11 | """ | 12 | 12 |
| | 28 | 28 | # Set anomaly scale to 20 centimeters | 29 | 29 | scale="20c", | 30 | 30 | # Fill positive areas red | 31 | | - fillpositive="red", | | 31 | + positive_fill="red", | 32 | 32 | # Fill negative areas gray | 33 | | - fillnegative="gray", | | 33 | + negative_fill="gray", | 34 | 34 | # Set the outline width to 1.0 point | 35 | 35 | pen="1.0p", | 36 | 36 | # Draw a blue track with a width of 0.5 points | |
Collapse file Copy file name to clipboardExpand all lines: examples/gallery/symbols/patterns.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | - :meth:`pygmt.Figure.ternary`: Symbols via ``fill`` | 18 | 18 | - :meth:`pygmt.Figure.velo`: Uncertainty wedges and velocity error ellipses via | 19 | 19 | ``uncertaintyfill`` | 20 | | -- :meth:`pygmt.Figure.wiggle`: Anomalies via ``fillpositive`` and ``fillnegative`` | | 20 | +- :meth:`pygmt.Figure.wiggle`: Anomalies via ``positive_fill`` and ``negative_fill`` | 21 | 21 |
| 22 | 22 | GMT provides 90 predefined 1-bit patterns, which are numbered from 1 to 90. In addition, | 23 | 23 | custom 1-, 8-, or 24-bit image raster files can also be used as patterns. | |
Collapse file Copy file name to clipboardExpand all lines: pygmt/src/wiggle.py +20-14Lines changed: 20 additions & 14 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | from pygmt._typing import PathLike, TableLike | 9 | 9 | from pygmt.alias import Alias, AliasSystem | 10 | 10 | 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 | 12 | 12 |
| 13 | 13 |
| 14 | | -def _parse_fills(fillpositive, fillnegative): | | 14 | +def _parse_fills(positive_fill, negative_fill): | 15 | 15 | """ | 16 | | - Parse the fillpositive and fillnegative parameters. | | 16 | + Parse the positive_fill and negative_fill parameters. | 17 | 17 |
| 18 | 18 | >>> _parse_fills("red", "blue") | 19 | 19 | ['red+p', 'blue+n'] | @@ -24,10 +24,10 @@ def _parse_fills(fillpositive, fillnegative): | 24 | 24 | >>> _parse_fills(None, None) | 25 | 25 | """ | 26 | 26 | _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") | 31 | 31 |
| 32 | 32 | match len(_fills): | 33 | 33 | case 0: | @@ -39,6 +39,12 @@ def _parse_fills(fillpositive, fillnegative): | 39 | 39 |
| 40 | 40 |
| 41 | 41 | @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 | +) | 42 | 48 | @use_alias( | 43 | 49 | D="position", | 44 | 50 | T="track", | @@ -58,8 +64,8 @@ def wiggle( # noqa: PLR0913 | 58 | 64 | x=None, | 59 | 65 | y=None, | 60 | 66 | z=None, | 61 | | - fillpositive=None, | 62 | | - fillnegative=None, | | 67 | + positive_fill=None, | | 68 | + negative_fill=None, | 63 | 69 | projection: str | None = None, | 64 | 70 | region: Sequence[float | str] | str | None = None, | 65 | 71 | frame: str | Sequence[str] | bool = False, | @@ -83,7 +89,7 @@ def wiggle( # noqa: PLR0913 | 83 | 89 |
| 84 | 90 | $aliases | 85 | 91 | - B = frame | 86 | | - - G = **+p**: fillpositive, **+n**: fillnegative | | 92 | + - G = **+p**: positive_fill, **+n**: negative_fill | 87 | 93 | - J = projection | 88 | 94 | - R = region | 89 | 95 | - V = verbose | @@ -114,9 +120,9 @@ def wiggle( # noqa: PLR0913 | 114 | 120 | **+w**\ *length*\ [**+j**\ *justify*]\ [**+al**\|\ **r**]\ | 115 | 121 | [**+o**\ *dx*\ [/*dy*]][**+l**\ [*label*]]. | 116 | 122 | Define the reference point on the map for the vertical scale bar. | 117 | | - fillpositive : str | | 123 | + positive_fill : str | 118 | 124 | Set color or pattern for filling positive wiggles [Default is no fill]. | 119 | | - fillnegative : str | | 125 | + negative_fill : str | 120 | 126 | Set color or pattern for filling negative wiggles [Default is no fill]. | 121 | 127 | track : str | 122 | 128 | Draw track [Default is no track]. Append pen attributes to use | @@ -138,10 +144,10 @@ def wiggle( # noqa: PLR0913 | 138 | 144 | """ | 139 | 145 | self._activate_figure() | 140 | 146 |
| 141 | | - _fills = _parse_fills(fillpositive, fillnegative) | | 147 | + _fills = _parse_fills(positive_fill, negative_fill) | 142 | 148 |
| 143 | 149 | aliasdict = AliasSystem( | 144 | | - G=Alias(_fills, name="fillpositive/fillnegative"), | | 150 | + G=Alias(_fills, name="positive_fill/negative_fill"), | 145 | 151 | ).add_common( | 146 | 152 | B=frame, | 147 | 153 | J=projection, | |
Collapse file Copy file name to clipboardExpand all lines: pygmt/tests/test_wiggle.py +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,8 +24,8 @@ def test_wiggle(): | 24 | 24 | y=y, | 25 | 25 | z=z, | 26 | 26 | scale="0.5c", | 27 | | - fillpositive="red", | 28 | | - fillnegative="gray", | | 27 | + positive_fill="red", | | 28 | + negative_fill="gray", | 29 | 29 | pen="1.0p", | 30 | 30 | track="0.5p", | 31 | 31 | position="jRM+w2+lnT", | @@ -54,8 +54,8 @@ def test_wiggle_data_incols(): | 54 | 54 | projection="X8c", | 55 | 55 | incols=[1, 0, 2], | 56 | 56 | scale="0.5c", | 57 | | - fillpositive="red", | 58 | | - fillnegative="gray", | | 57 | + positive_fill="red", | | 58 | + negative_fill="gray", | 59 | 59 | pen="1.0p", | 60 | 60 | track="0.5p", | 61 | 61 | position="jRM+w2+lnT", | |
|