8000 Merge pull request #19823 from meeseeksmachine/auto-backport-of-pr-19… · matplotlib/matplotlib@0b647f6 · GitHub
[go: up one dir, main page]

Skip to content

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

Commit 0b647f6

Browse files
authored
Merge pull request #19823 from meeseeksmachine/auto-backport-of-pr-19814-on-v3.4.x
Backport PR #19814 on branch v3.4.x (Fix positioning of annotation arrow.)
2 parents cc25819 + eeeda2b commit 0b647f6

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
Loading

lib/matplotlib/tests/test_axes.py

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

4903-
plt.annotate("Center point", xy=(1, 2), xytext=(1, 1.5),
4903+
plt.annotate("Center point", xy=(1, 2), xytext=(1, 1.3),
49044904
arrowprops=dict(arrowstyle="->",
4905-
connectionstyle="arc3"))
4905+
connectionstyle="arc3"),
4906+
bbox=dict(boxstyle="square", facecolor="lightgrey"))
49064907
# Set aspect ratio to be equal so that pie is drawn as a circle.
49074908
plt.axis('equal')
49084909

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)
0