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
1 change: 0 additions & 1 deletion lib/matplotlib/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
'*/matplotlib/rcsetup.py',
'*/matplotlib/stackplot.py',
'*/matplotlib/texmanager.py',
'*/matplotlib/text.py',
'*/matplotlib/transforms.py',
'*/matplotlib/type1font.py',
'*/matplotlib/widgets.py',
Expand Down
25 changes: 18 additions & 7 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from six.moves import zip

import math
import warnings

import numpy as np

Expand Down Expand Up @@ -358,7 +359,7 @@ def _get_layout(self, renderer):
cornersHoriz = np.array(
[(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)],
np.float_)
cornersHoriz[:,1] -= descent
cornersHoriz[:, 1] -= descent

# now rotate the bbox
cornersRotated = M.transform(cornersHoriz)
Expand Down Expand Up @@ -574,7 +575,6 @@ def draw(self, renderer):
renderer = PathEffectRenderer(self.get_path_effects(),
renderer)


if rcParams['text.usetex']:
renderer.draw_tex(gc, x, y, clean_line,
self._fontproperties, angle, mtext=self)
Expand Down Expand Up @@ -1536,7 +1536,7 @@ def _get_ref_xy(self, renderer):
if isinstance(self.xycoords, tuple):
s1, s2 = self.xycoords
if ((is_string_like(s1) and s1.split()[0] == "offset") or
(is_string_like(s2) and s2.split()[0] == "offset")):
(is_string_like(s2) and s2.split()[0] == "offset")):
raise ValueError("xycoords should not be an offset coordinate")
x, y = self.xy
x1, y1 = self._get_xy(renderer, x, y, s1)
Expand Down Expand Up @@ -1631,22 +1631,26 @@ def draggable(self, state=None, use_blit=False):
return self._draggable

@property
@cbook.deprecated('1.4', message='Use `anncoords` instead', name='textcoords', alternative='anncoords')
@cbook.deprecated('1.4', message='Use `anncoords` instead',
name='textcoords', alternative='anncoords')
def textcoords(self):
return self.anncoords

@textcoords.setter
@cbook.deprecated('1.4', message='Use `anncoords` instead', name='textcoords', alternative='anncoords')
@cbook.deprecated('1.4', message='Use `anncoords` instead',
name='textcoords', alternative='anncoords')
def textcoords(self, val):
self.anncoords = val

@property
@cbook.deprecated('1.4', message='Use `xyann` instead', name='xytext', alternative='xyann')
@cbook.deprecated('1.4', message='Use `xyann` instead',
name='xytext', alternative='xyann')
def xytext(self):
self.xyann

@xytext.setter
@cbook.deprecated('1.4', message='Use `xyann` instead', name='xytext', alternative='xyann')
@cbook.deprecated('1.4', message='Use `xyann` instead',
name='xytext', alternative='xyann')
def xytext(self, val):
self.xyann = val

Expand Down Expand Up @@ -1776,6 +1780,13 @@ def __init__(self, s, xy,
xy,
xycoords=xycoords,
annotation_clip=annotation_clip)
# warn about wonky input data
if (xytext is None and
textcoords is not None and
textcoords != xycoords):
warnings.warn("You have used the `textcoords` kwarg, but not "
"the `xytext` kwarg. This can lead to surprising "
"results.")

# clean up textcoords and assign default
if textcoords is None:
Expand Down