simonb
simonb

Reputation: 2827

Handling frame resize in matplotlib animation with WXAgg backend

I am doing some animated plotting and using the the matplotlib examples as a guideline. matplotlib examples

With the following linked example from that page the animation has some obvious problems when the frame is resized. What is the correct or best way to deal with this? animation_blit_wx.py
Thanks

Upvotes: 1

Views: 2021

Answers (1)

tillsten
tillsten

Reputation: 14878

Take a look at the animation_blit_qt4.py example. You have to check the figure size manually, and if it has changed you need to draw the background again.

Heres the part which does that from the qt example, self is a Figure Canvas:

 current_size = self.ax.bbox.width, self.ax.bbox.height
    if self.old_size != current_size:
        self.old_size = current_size
        self.ax.clear()
        self.ax.grid()
        self.draw()
        self.ax_background = self.copy_from_bbox(self.ax.bbox)

Upvotes: 1

Related Questions