Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a926a30

Browse files
dikshajangra12918-ossapple
authored andcommitted
Fix Annotation arrow not updating after setting patchA
Setting patchA on Annotation.arrow_patch has no visible effect because the arrow position is not recomputed. This change ensures that the annotation is marked as stale when patchA changes, triggering proper recomputation during rendering.
1 parent e6640db commit a926a30

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/matplotlib/text.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,8 +2199,14 @@ def update_positions(self, renderer):
21992199
xy=(bbox.x0 - pad / 2, bbox.y0 - pad / 2),
22002200
width=bbox.width + pad, height=bbox.height + pad,
22012201
transform=IdentityTransform(), clip_on=False)
2202+
old_patchA = self.arrow_patch.patchA
22022203
self.arrow_patch.set_patchA(patchA)
22032204

2205+
# Ensure arrow updates when patchA changes
2206+
if old_patchA is not patchA:
2207+
self.stale = True
2208+
2209+
22042210
@artist.allow_rasterization
22052211
def draw(self, renderer):
22062212
# docstring inherited

0 commit comments

Comments
 (0)