Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ENH : added warning on annotate #2746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2014
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 1 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 25 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.