|
8 | 8 | from six.moves import zip
|
9 | 9 |
|
10 | 10 | import math
|
| 11 | +import warnings |
11 | 12 |
|
12 | 13 | import numpy as np
|
13 | 14 |
|
@@ -358,7 +359,7 @@ def _get_layout(self, renderer):
|
358 | 359 | cornersHoriz = np.array(
|
359 | 360 | [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)],
|
360 | 361 | np.float_)
|
361 |
| - cornersHoriz[:,1] -= descent |
| 362 | + cornersHoriz[:, 1] -= descent |
362 | 363 |
|
363 | 364 | # now rotate the bbox
|
364 | 365 | cornersRotated = M.transform(cornersHoriz)
|
@@ -574,7 +575,6 @@ def draw(self, renderer):
|
574 | 575 | renderer = PathEffectRenderer(self.get_path_effects(),
|
575 | 576 | renderer)
|
576 | 577 |
|
577 |
| - |
578 | 578 | if rcParams['text.usetex']:
|
579 | 579 | renderer.draw_tex(gc, x, y, clean_line,
|
580 | 580 | self._fontproperties, angle, mtext=self)
|
@@ -1536,7 +1536,7 @@ def _get_ref_xy(self, renderer):
|
1536 | 1536 | if isinstance(self.xycoords, tuple):
|
1537 | 1537 | s1, s2 = self.xycoords
|
1538 | 1538 | if ((is_string_like(s1) and s1.split()[0] == "offset") or
|
1539 |
| - (is_string_like(s2) and s2.split()[0] == "offset")): |
| 1539 | + (is_string_like(s2) and s2.split()[0] == "offset")): |
1540 | 1540 | raise ValueError("xycoords should not be an offset coordinate")
|
1541 | 1541 | x, y = self.xy
|
1542 | 1542 | x1, y1 = self._get_xy(renderer, x, y, s1)
|
@@ -1631,22 +1631,26 @@ def draggable(self, state=None, use_blit=False):
|
1631 | 1631 | return self._draggable
|
1632 | 1632 |
|
1633 | 1633 | @property
|
1634 |
| - @cbook.deprecated('1.4', message='Use `anncoords` instead', name='textcoords', alternative='anncoords') |
| 1634 | + @cbook.deprecated('1.4', message='Use `anncoords` instead', |
| 1635 | + name='textcoords', alternative='anncoords') |
1635 | 1636 | def textcoords(self):
|
1636 | 1637 | return self.anncoords
|
1637 | 1638 |
|
1638 | 1639 | @textcoords.setter
|
1639 |
| - @cbook.deprecated('1.4', message='Use `anncoords` instead', name='textcoords', alternative='anncoords') |
| 1640 | + @cbook.deprecated('1.4', message='Use `anncoords` instead', |
| 1641 | + name='textcoords', alternative='anncoords') |
1640 | 1642 | def textcoords(self, val):
|
1641 | 1643 | self.anncoords = val
|
1642 | 1644 |
|
1643 | 1645 | @property
|
1644 |
| - @cbook.deprecated('1.4', message='Use `xyann` instead', name='xytext', alternative='xyann') |
| 1646 | + @cbook.deprecated('1.4', message='Use `xyann` instead', |
| 1647 | + name='xytext', alternative='xyann') |
1645 | 1648 | def xytext(self):
|
1646 | 1649 | self.xyann
|
1647 | 1650 |
|
1648 | 1651 | @xytext.setter
|
1649 |
| - @cbook.deprecated('1.4', message='Use `xyann` instead', name='xytext', alternative='xyann') |
| 1652 | + @cbook.deprecated('1.4', message='Use `xyann` instead', |
| 1653 | + name='xytext', alternative='xyann') |
1650 | 1654 | def xytext(self, val):
|
1651 | 1655 | self.xyann = val
|
1652 | 1656 |
|
@@ -1776,6 +1780,13 @@ def __init__(self, s, xy,
|
1776 | 1780 | xy,
|
1777 | 1781 | xycoords=xycoords,
|
1778 | 1782 | annotation_clip=annotation_clip)
|
| 1783 | + # warn about wonky input data |
| 1784 | + if (xytext is None and |
| 1785 | + textcoords is not None and |
| 1786 | + textcoords != xycoords): |
| 1787 | + warnings.warn("You have used the `textcoords` kwarg, but not " |
| 1788 | + "the `xytext` kwarg. This can lead to surprising " |
| 1789 | + "results.") |
1779 | 1790 |
|
1780 | 1791 | # clean up textcoords and assign default
|
1781 | 1792 | if textcoords is None:
|
|
0 commit comments