Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,29 +699,30 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):

>>> text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
"""
default = {
if fontdict is None:
fontdict = {}

effective_kwargs = {
'verticalalignment': 'baseline',
'horizontalalignment': 'left',
'transform': self.transData,
'clip_on': False}
'clip_on': False,
**fontdict,
**kwargs,
}

# At some point if we feel confident that TextWithDash
# is robust as a drop-in replacement for Text and that
# the performance impact of the heavier-weight class
# isn't too significant, it may make sense to eliminate
# the withdash kwarg and simply delegate whether there's
# a dash to TextWithDash and dashlength.

if withdash:
t = mtext.TextWithDash(
x=x, y=y, text=s)
t = mtext.TextWithDash(x, y, text=s)
else:
t = mtext.Text(
x=x, y=y, text=s)

t.update(default)
if fontdict is not None:
t.update(fontdict)
t.update(kwargs)
t = mtext.Text(x, y, text=s)
t.update(effective_kwargs)

t.set_clip_path(self.patch)
self._add_text(t)
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,8 @@ def __init__(self,
multialignment=multialignment,
fontproperties=fontproperties,
rotation=rotation,
linespacing=linespacing)
linespacing=linespacing,
)

# The position (x,y) values for text and dashline
# are bogus as given in the instantiation; they will
Expand Down