Skip to content

Commit 4e9798f

Browse files
authored
Merge pull request matplotlib#19814 from QuLogic/fix-fancyarrow
Fix positioning of annotation arrow.
2 parents db2eac3 + 28770ba commit 4e9798f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
632 Bytes
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4923,9 +4923,10 @@ def test_pie_center_radius():
49234923
autopct='%1.1f%%', shadow=True, startangle=90,
49244924
wedgeprops={'linewidth': 0}, center=(1, 2), radius=1.5)
49254925

4926-
plt.annotate("Center point", xy=(1, 2), xytext=(1, 1.5),
4926+
plt.annotate("Center point", xy=(1, 2), xytext=(1, 1.3),
49274927
arrowprops=dict(arrowstyle="->",
4928-
connectionstyle="arc3"))
4928+
connectionstyle="arc3"),
4929+
bbox=dict(boxstyle="square", facecolor="lightgrey"))
49294930
# Set aspect ratio to be equal so that pie is drawn as a circle.
49304931
plt.axis('equal')
49314932

lib/matplotlib/text.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,10 @@ def draw(self, renderer):
19491949
self._renderer = renderer
19501950
if not self.get_visible() or not self._check_xy(renderer):
19511951
return
1952+
# Update text positions before `Text.draw` would, so that the
1953+
# FancyArrowPatch is correctly positioned.
19521954
self.update_positions(renderer)
1955+
self.update_bbox_position_size(renderer)
19531956
if self.arrow_patch is not None: # FancyArrowPatch
19541957
if self.arrow_patch.figure is None and self.figure is not None:
19551958
self.arrow_patch.figure = self.figure

0 commit comments

Comments
 (0)