Skip to content

Commit c0dd933

Browse files
authored
Figure.text: Migrate the fill/pen parameters to the new alias system (#4489)
1 parent 351c45a commit c0dd933

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

pygmt/src/text.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
@use_alias(
2626
C="clearance",
2727
D="offset",
28-
G="fill",
29-
W="pen",
3028
a="aspatial",
3129
e="find",
3230
f="coltypes",
@@ -41,8 +39,10 @@ def text_( # noqa: PLR0912, PLR0913
4139
y=None,
4240
position: AnchorCode | None = None,
4341
text: str | StringArrayTypes | None = None,
44-
angle=None,
45-
font=None,
42+
angle: float | Sequence[float] | bool = False,
43+
font: str | StringArrayTypes | bool = False,
44+
fill: str | None = None,
45+
pen: str | None = None,
4646
justify: bool | None | AnchorCode | Sequence[AnchorCode] = None,
4747
no_clip: bool = False,
4848
projection: str | None = None,
@@ -74,10 +74,12 @@ def text_( # noqa: PLR0912, PLR0913
7474
$aliases
7575
- B = frame
7676
- F = **+a**: angle, **+c**: position, **+j**: justify, **+f**: font
77+
- G = fill
7778
- J = projection
7879
- N = no_clip
7980
- R = region
8081
- V = verbose
82+
- W = pen
8183
- c = panel
8284
- p = perspective
8385
- t = transparency
@@ -146,8 +148,11 @@ def text_( # noqa: PLR0912, PLR0913
146148
**O** to get a rounded rectangle. In paragraph mode (*paragraph*)
147149
you can also append lowercase **c** to get a concave rectangle or
148150
append uppercase **C** to get a convex rectangle.
149-
fill : str
151+
fill
150152
Set color for filling text boxes [Default is no fill].
153+
pen
154+
Set the pen used to draw a rectangle around the text string (see ``clearance``)
155+
[Default is ``"0.25p,black,solid"``].
151156
offset : str
152157
[**j**\|\ **J**]\ *dx*\[/*dy*][**+v**\[*pen*]].
153158
Offset the text from the projected (x, y) point by *dx*/\ *dy*
@@ -159,9 +164,6 @@ def text_( # noqa: PLR0912, PLR0913
159164
Optionally, append **+v** which will draw a line from the original
160165
point to the shifted point; append a pen to change the attributes
161166
for this line.
162-
pen : str
163-
Set the pen used to draw a rectangle around the text string
164-
(see ``clearance``) [Default is ``"0.25p,black,solid"``].
165167
no_clip
166168
Do **not** clip text at the frame boundaries [Default is ``False``].
167169
$projection
@@ -273,7 +275,9 @@ def text_( # noqa: PLR0912, PLR0913
273275
)
274276

275277
aliasdict = AliasSystem(
278+
G=Alias(fill, name="fill"),
276279
N=Alias(no_clip, name="no_clip"),
280+
W=Alias(pen, name="pen"),
277281
).add_common(
278282
B=frame,
279283
J=projection,

0 commit comments

Comments
 (0)