Skip to content

Commit 138617f

Browse files
committed
Alias pen(W) for text
1 parent 4c52613 commit 138617f

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

pygmt/base_plotting.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
813813
lib.call_module("legend", arg_str)
814814

815815
@fmt_docstring
816-
@use_alias(R="region", J="projection", B="frame")
816+
@use_alias(R="region", J="projection", B="frame", W="pen")
817817
@kwargs_to_strings(
818818
R="sequence",
819819
textfiles="sequence_space",
@@ -867,7 +867,7 @@ def text(
867867
Helvetica-Bold font. If no font info is explicitly given (i.e.
868868
font=True), then the input textfile(s) must have this information
869869
in one of its columns.
870-
justify: str or bool
870+
justify : str or bool
871871
Set the alignment which refers to the part of the text string that
872872
will be mapped onto the (x,y) point. Choose a 2 character
873873
combination of L, C, R (for left, center, or right) and T, M, B for
@@ -876,6 +876,10 @@ def text(
876876
input textfile(s) must have this as a column.
877877
{J}
878878
{R}
879+
pen : str
880+
Sets the pen used to draw a rectangle around the text string
881+
(see *clearance*) [Default is width = default, color = black,
882+
style = solid].
879883
"""
880884
kwargs = self._preprocess(**kwargs)
881885

2.45 KB
Loading

pygmt/tests/test_text.py

+17
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,23 @@ def test_text_font_bold(region, projection):
131131
return fig
132132

133133

134+
@pytest.mark.mpl_image_compare
135+
def test_text_pen(region, projection):
136+
"""
137+
Print text with thick green dashed pen
138+
"""
139+
fig = Figure()
140+
fig.text(
141+
region=region,
142+
projection=projection,
143+
x=1.2,
144+
y=1.2,
145+
text="green pen around text",
146+
pen="thick,green,dashed",
147+
)
148+
return fig
149+
150+
134151
@pytest.mark.mpl_image_compare
135152
def test_text_justify_bottom_right_and_top_left(region, projection):
136153
"""

0 commit comments

Comments
 (0)