Skip to content

Commit

Permalink
Alias pen(W) for text
Browse files Browse the repository at this point in the history
  • Loading branch information
weiji14 committed Jun 19, 2020
1 parent 4c52613 commit 138617f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pygmt/base_plotting.py
Expand Up @@ -813,7 +813,7 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
lib.call_module("legend", arg_str)

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

Expand Down
Binary file added pygmt/tests/baseline/test_text_pen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions pygmt/tests/test_text.py
Expand Up @@ -131,6 +131,23 @@ def test_text_font_bold(region, projection):
return fig


@pytest.mark.mpl_image_compare
def test_text_pen(region, projection):
"""
Print text with thick green dashed pen
"""
fig = Figure()
fig.text(
region=region,
projection=projection,
x=1.2,
y=1.2,
text="green pen around text",
pen="thick,green,dashed",
)
return fig


@pytest.mark.mpl_image_compare
def test_text_justify_bottom_right_and_top_left(region, projection):
"""
Expand Down

0 comments on commit 138617f

Please sign in to comment.