From 83b322a9b93ded8199d250e9c8e622a941b1d395 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 14 Dec 2015 20:19:26 -0500 Subject: [PATCH 1/3] FIX #5680 span selector + blit + span_stays broken The rect properties for the 'live' rect were being forwarded re-used for the stay artist, however if blitting is used, then 'animated' is set which exclude the artist from the normal draw tree. --- lib/matplotlib/widgets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index d641a54abfda..04c2d137651c 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1473,6 +1473,7 @@ def new_axes(self, ax): transform=trans, visible=False, **self.rectprops) + self.stay_rect.set_animated(False) self.ax.add_patch(self.stay_rect) self.ax.add_patch(self.rect) From a8934dcc74f6fd877bd95e1fff944e37033ee2ce Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 14 Dec 2015 20:22:04 -0500 Subject: [PATCH 2/3] ENH: when re-drawing the span clear previous span Force a full re-draw on the last span is not in the blit background --- lib/matplotlib/widgets.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 04c2d137651c..d90a467423b3 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1488,7 +1488,10 @@ def _press(self, event): self.rect.set_visible(self.visible) if self.span_stays: self.stay_rect.set_visible(False) - + # really force a draw so that the stay rect is not in + # the blit background + if self.useblit: + self.canvas.draw() xdata, ydata = self._get_data(event) if self.direction == 'horizontal': self.pressv = xdata From 8bc19ec4ed46d9798e8d7db7191e56521b5762f3 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 14 Dec 2015 20:23:23 -0500 Subject: [PATCH 3/3] PRF: change draw on release to a draw_idle --- lib/matplotlib/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index d90a467423b3..c061951464d6 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1514,7 +1514,7 @@ def _release(self, event): self.stay_rect.set_height(self.rect.get_height()) self.stay_rect.set_visible(True) - self.canvas.draw() + self.canvas.draw_idle() vmin = self.pressv xdata, ydata = self._get_data(event) if self.direction == 'horizontal':