Skip to content

Commit 1e6af77

Browse files
committed
remove more YAArrow debris
1 parent 197fc9f commit 1e6af77

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

lib/matplotlib/tests/test_text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,11 @@ def test_text_with_arrow_annotation_get_window_extent():
382382
# bounding box of annotation (text + arrow)
383383
bbox = ann.get_window_extent(renderer=renderer)
384384
# bounding box of arrow
385-
arrow_bbox = ann.arrow.get_window_extent(renderer)
385+
arrow_bbox = ann.arrow_patch.get_window_extent(renderer)
386386
# bounding box of annotation text
387387
ann_txt_bbox = Text.get_window_extent(ann)
388388

389-
# make sure annotation with in 50 px wider than
389+
# make sure annotation width is 50 px wider than
390390
# just the text
391391
eq_(bbox.width, text_bbox.width + 50.0)
392392
# make sure the annotation text bounding box is same size

lib/matplotlib/text.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from matplotlib.cbook import is_string_like, maxdict
2222
from matplotlib import docstring
2323
from matplotlib.font_manager import FontProperties
24-
from matplotlib.patches import YAArrow, FancyBboxPatch
24+
from matplotlib.patches import FancyBboxPatch
2525
from matplotlib.patches import FancyArrowPatch, Rectangle
2626
import matplotlib.transforms as mtransforms
2727
from matplotlib.transforms import Affine2D, Bbox, Transform
@@ -531,7 +531,7 @@ def update_bbox_position_size(self, renderer):
531531
posx, posy = trans.transform_point((posx, posy))
532532

533533
x_box, y_box, w_box, h_box = _get_textbox(self, renderer,
534-
with_descent=False)
534+
with_descent=True)
535535
self._bbox_patch.set_bounds(0., 0., w_box, h_box)
536536
theta = np.deg2rad(self.get_rotation())
537537
tr = mtransforms.Affine2D().rotate(theta)
@@ -548,7 +548,7 @@ def _draw_bbox(self, renderer, posx, posy):
548548
"""
549549

550550
x_box, y_box, w_box, h_box = _get_textbox(self, renderer,
551-
with_descent=False)
551+
with_descent=True)
552552
self._bbox_patch.set_bounds(0., 0., w_box, h_box)
553553
theta = np.deg2rad(self.get_rotation())
554554
tr = mtransforms.Affine2D().rotate(theta)
@@ -558,7 +558,6 @@ def _draw_bbox(self, renderer, posx, posy):
558558
self._bbox_patch.set_mutation_scale(fontsize_in_pixel)
559559
self._bbox_patch.draw(renderer)
560560

561-
562561
def _update_clip_properties(self):
563562
clipprops = dict(clip_box=self.clipbox,
564563
clip_path=self._clippath,
@@ -2114,7 +2113,6 @@ def _update_position_xytext(self, renderer, xy_pixel):
21142113
self.set_transform(self._get_xy_transform(
21152114
renderer, self.xy, self.anncoords))
21162115

2117-
21182116
ox0, oy0 = self._get_xy_display()
21192117
ox1, oy1 = xy_pixel
21202118

@@ -2172,7 +2170,6 @@ def _update_position_xytext(self, renderer, xy_pixel):
21722170
self.arrow_patch.shrinkA = shrink_pts
21732171
self.arrow_patch.shrinkB = shrink_pts
21742172

2175-
21762173
# adjust the starting point of the arrow relative to
21772174
# the textbox.
21782175
# TODO : Rotation needs to be accounted.
@@ -2243,7 +2240,6 @@ def draw(self, renderer):
22432240
# Otherwise, a wedge arrowstyle can land partly on top of the Bbox.
22442241
Text.draw(self, renderer)
22452242

2246-
22472243
def get_window_extent(self, renderer=None):
22482244
'''
22492245
Return a :class:`~matplotlib.transforms.Bbox` object bounding

0 commit comments

Comments
 (0)