Skip to content

Commit 51c77d6

Browse files
authored
Merge pull request #12030 from akhilman/speed-up-gtk3agg-redraw
Speed up canvas redraw for GTK3Agg backend.
2 parents ade45f2 + db3b741 commit 51c77d6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backends/backend_gtk3agg.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def on_draw_event(self, widget, ctx):
2626
w, h = allocation.width, allocation.height
2727

2828
if not len(self._bbox_queue):
29-
self._render_figure(w, h)
3029
Gtk.render_background(
3130
self.get_style_context(), ctx,
3231
allocation.x, allocation.y,
@@ -71,6 +70,12 @@ def blit(self, bbox=None):
7170
self._bbox_queue.append(bbox)
7271
self.queue_draw_area(x, y, width, height)
7372

73+
def draw(self):
74+
if self.get_visible() and self.get_mapped():
75+
allocation = self.get_allocation()
76+
self._render_figure(allocation.width, allocation.height)
77+
super().draw()
78+
7479
def print_png(self, filename, *args, **kwargs):
7580
# Do this so we can save the resolution of figure in the PNG file
7681
agg = self.switch_backends(backend_agg.FigureCanvasAgg)

0 commit comments

Comments
 (0)