Skip to content

Commit 9b8e837

Browse files
committed
Alias fill(G) for text
1 parent 45a9858 commit 9b8e837

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

pygmt/base_plotting.py

+8-1
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", C="clearance", W="pen")
816+
@use_alias(R="region", J="projection", B="frame", C="clearance", G="fill", W="pen")
817817
@kwargs_to_strings(
818818
R="sequence",
819819
textfiles="sequence_space",
@@ -888,6 +888,13 @@ def text(
888888
rounded rectangle. In paragraph mode (*paragraph*) you can also
889889
append lower case 'c' to get a concave rectangle or append upper
890890
case 'C' to get a convex rectangle.
891+
fill : str
892+
Sets the shade or color used for filling the text box [Default is
893+
no fill]. Alternatively, use fill='c' to plot the text and then use
894+
the text dimensions (and *clearance*) to build clip paths and turn
895+
clipping on. This clipping can then be turned off later with clip
896+
-C. To not plot the text but activate clipping, use fill='C'
897+
instead.
891898
pen : str
892899
Sets the pen used to draw a rectangle around the text string
893900
(see *clearance*) [Default is width = default, color = black,
1.87 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_fill(region, projection):
136+
"""
137+
Print text with blue color fill
138+
"""
139+
fig = Figure()
140+
fig.text(
141+
region=region,
142+
projection=projection,
143+
x=1.2,
144+
y=1.2,
145+
text="blue fill around text",
146+
fill="blue",
147+
)
148+
return fig
149+
150+
134151
@pytest.mark.mpl_image_compare
135152
def test_text_pen(region, projection):
136153
"""

0 commit comments

Comments
 (0)