Skip to content

Commit 9d0c000

Browse files
committed
Figure.wiggle: Refactor using the new alias system
1 parent b4a94d7 commit 9d0c000

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

pygmt/src/wiggle.py

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pygmt.alias import Alias, AliasSystem
1010
from pygmt.clib import Session
1111
from pygmt.helpers import build_arg_list, deprecate_parameter, fmt_docstring, use_alias
12+
from pygmt.params import Position
1213

1314

1415
def _parse_fills(positive_fill, negative_fill):
@@ -46,7 +47,6 @@ def _parse_fills(positive_fill, negative_fill):
4647
"fillnegative", "negative_fill", "v0.18.0", remove_version="v0.20.0"
4748
)
4849
@use_alias(
49-
D="position",
5050
T="track",
5151
W="pen",
5252
Z="scale",
@@ -64,6 +64,10 @@ def wiggle( # noqa: PLR0913
6464
x=None,
6565
y=None,
6666
z=None,
67+
position: Position | None = None,
68+
length: float | str | None = None,
69+
label: str | None = None,
70+
label_alignment: Literal["left", "right"] | None = None,
6771
positive_fill=None,
6872
negative_fill=None,
6973
projection: str | None = None,
@@ -107,29 +111,34 @@ def wiggle( # noqa: PLR0913
107111
$table_classes.
108112
Use parameter ``incols`` to choose which columns are x, y, z,
109113
respectively.
110-
$projection
111-
$region
114+
position
115+
Specify the position of the vertical scale bar on the plot. See
116+
:class:`pygmt.params.Position` for more details.
117+
length
118+
Length of the vertical scale bar in data (z) units.
119+
label
120+
Set the z unit label that is used in the scale label [Default is no unit].
121+
label_alignment
122+
Set the alignment of the scale label. Choose from ``"left"`` or ``"right"``
123+
[Default is ``"left"``].
112124
scale : str or float
113125
Give anomaly scale in data-units/distance-unit. Append **c**, **i**,
114126
or **p** to indicate the distance unit (centimeters, inches, or
115127
points); if no unit is given we use the default unit that is
116128
controlled by :gmt-term:`PROJ_LENGTH_UNIT`.
117-
$frame
118-
position : str
119-
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
120-
**+w**\ *length*\ [**+j**\ *justify*]\ [**+al**\|\ **r**]\
121-
[**+o**\ *dx*\ [/*dy*]][**+l**\ [*label*]].
122-
Define the reference point on the map for the vertical scale bar.
123129
positive_fill : str
124130
Set color or pattern for filling positive wiggles [Default is no fill].
125131
negative_fill : str
126132
Set color or pattern for filling negative wiggles [Default is no fill].
127133
track : str
128134
Draw track [Default is no track]. Append pen attributes to use
129135
[Default is ``"0.25p,black,solid"``].
130-
$verbose
131136
pen : str
132137
Specify outline pen attributes [Default is no outline].
138+
$projection
139+
$region
140+
$frame
141+
$verbose
133142
$binary
134143
$panel
135144
$nodata
@@ -147,6 +156,17 @@ def wiggle( # noqa: PLR0913
147156
_fills = _parse_fills(positive_fill, negative_fill)
148157

149158
aliasdict = AliasSystem(
159+
D=[
160+
Alias(position, name="position"),
161+
Alias(length, name="length", prefix="+w"),
162+
Alias(
163+
label_alignment,
164+
name="label_alignment",
165+
prefix="+a",
166+
mapping={"left": "l", "right": "r"},
167+
),
168+
Alias(label, name="label", prefix="+l"),
169+
],
150170
G=Alias(_fills, name="positive_fill/negative_fill"),
151171
).add_common(
152172
B=frame,

0 commit comments

Comments
 (0)