Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9eceef3

Browse files
committed
Handle the case in which boxstyle is a callable, not a string
1 parent 3e88b3a commit 9eceef3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/matplotlib/text.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def get_rotation(rotation):
9393
animated [True | False]
9494
backgroundcolor any matplotlib color
9595
bbox rectangle prop dict plus key 'pad' which is a
96-
pad in points; if a boxstyle is supplied, then
97-
pad is instead a fraction of the font size
96+
pad in points; if a boxstyle is supplied as
97+
a string, then pad is instead a fraction
98+
of the font size
9899
clip_box a matplotlib.transform.Bbox instance
99100
clip_on [True | False]
100101
color any matplotlib color
@@ -498,7 +499,9 @@ def set_bbox(self, rectprops):
498499
else:
499500
if pad is None:
500501
pad = 0.3
501-
if "pad" not in boxstyle:
502+
503+
# boxstyle could be a callable or a string
504+
if is_string_like(boxstyle) and "pad" not in boxstyle:
502505
boxstyle += ",pad=%0.2f" % pad
503506

504507
bbox_transmuter = props.pop("bbox_transmuter", None)

0 commit comments

Comments
 (0)