8
8
from pygmt .helpers import build_arg_list , fmt_docstring , kwargs_to_strings , use_alias
9
9
10
10
11
+ def _parse_fills (fillpositive , fillnegative ):
12
+ """
13
+ Parse the fillpositive and fillnegative parameters.
14
+
15
+ >>> _parse_fills("red", "blue")
16
+ ['red+p', 'blue+n']
17
+ >>> _parse_fills(None, "blue")
18
+ 'blue+n'
19
+ >>> _parse_fills("red", None)
20
+ 'red+p'
21
+ >>> _parse_fills(None, None)
22
+ """
23
+ _fills = []
24
+ if fillpositive is not None :
25
+ _fills .append (fillpositive + "+p" )
26
+ if fillnegative is not None :
27
+ _fills .append (fillnegative + "+n" )
28
+
29
+ match len (_fills ):
30
+ case 0 :
31
+ return None
32
+ case 1 :
33
+ return _fills [0 ]
34
+ case 2 :
35
+ return _fills
36
+
37
+
11
38
@fmt_docstring
12
39
@use_alias (
13
40
B = "frame" ,
14
41
D = "position" ,
15
- G = "fillpositive/fillnegative-" ,
16
42
R = "region" ,
17
43
T = "track" ,
18
44
V = "verbose" ,
@@ -53,6 +79,7 @@ def wiggle(
53
79
Full GMT docs at :gmt-docs:`wiggle.html`.
54
80
55
81
{aliases}
82
+ - G = **+p**: fillpositive, **+n**: fillnegative
56
83
- J = projection
57
84
58
85
Parameters
@@ -78,11 +105,9 @@ def wiggle(
78
105
[**+o**\ *dx*\ [/*dy*]][**+l**\ [*label*]].
79
106
Define the reference point on the map for the vertical scale bar.
80
107
fillpositive : str
81
- Set color or pattern for filling positive wiggles
82
- [Default is no fill].
108
+ Set color or pattern for filling positive wiggles [Default is no fill].
83
109
fillnegative : str
84
- Set color or pattern for filling negative wiggles
85
- [Default is no fill].
110
+ Set color or pattern for filling negative wiggles [Default is no fill].
86
111
track : str
87
112
Draw track [Default is no track]. Append pen attributes to use
88
113
[Default is ``"0.25p,black,solid"``].
@@ -103,15 +128,11 @@ def wiggle(
103
128
"""
104
129
self ._activate_figure ()
105
130
106
- if fillpositive or fillnegative :
107
- kwargs ["G" ] = []
108
- if fillpositive :
109
- kwargs ["G" ].append (fillpositive + "+p" )
110
- if fillnegative :
111
- kwargs ["G" ].append (fillnegative + "+n" )
131
+ _fills = _parse_fills (fillpositive , fillnegative )
112
132
113
133
aliasdict = AliasSystem (
114
134
J = Alias (projection , name = "projection" ),
135
+ G = Alias (_fills , name = "fillpositive/fillnegative" ),
115
136
).merge (kwargs )
116
137
117
138
with Session () as lib :
0 commit comments