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

Skip to content

Commit e8d8451

Browse files
committed
Merge pull request #5681 from tacaswell/fix_span_stay_blit
Fix span stay blit
2 parents 47dded2 + 8bc19ec commit e8d8451

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/widgets.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,7 @@ def new_axes(self, ax):
14731473
transform=trans,
14741474
visible=False,
14751475
**self.rectprops)
1476+
self.stay_rect.set_animated(False)
14761477
self.ax.add_patch(self.stay_rect)
14771478

14781479
self.ax.add_patch(self.rect)
@@ -1487,7 +1488,10 @@ def _press(self, event):
14871488
self.rect.set_visible(self.visible)
14881489
if self.span_stays:
14891490
self.stay_rect.set_visible(False)
1490-
1491+
# really force a draw so that the stay rect is not in
1492+
# the blit background
1493+
if self.useblit:
1494+
self.canvas.draw()
14911495
xdata, ydata = self._get_data(event)
14921496
if self.direction == 'horizontal':
14931497
self.pressv = xdata
@@ -1510,7 +1514,7 @@ def _release(self, event):
15101514
self.stay_rect.set_height(self.rect.get_height())
15111515
self.stay_rect.set_visible(True)
15121516

1513-
self.canvas.draw()
1517+
self.canvas.draw_idle()
15141518
vmin = self.pressv
15151519
xdata, ydata = self._get_data(event)
15161520
if self.direction == 'horizontal':

0 commit comments

Comments
 (0)