[Matplotlib-users] Why is flush_events() taking longer than expected?

Benjamin Root ben.v.root at gmail.com
Tue Jul 25 10:46:13 EDT 2017


When you say first and second flush_events(), do you mean the first and
second iterations, or fig_A and fig_B?

Ben Root

On Fri, Jul 21, 2017 at 9:33 AM, David Aldrich <David.Aldrich at emea.nec.com>
wrote:

> Hi
>
> I am using Matplotlib 2.0.2 in a Python 3.6 script on Windows 10 to plot
> data received over a network connection. New data arrives 4 times per
> second. I need to update two figures fig_A and fig_B, each containing 8
> subplots. The hardware is a fast i7 laptop.
>
> My main execution loop is:
>
> plt.draw()
>
> while (True):
>     fig_A.canvas.flush_events()
>     fig_B.canvas.flush_events()
>     updatePlots()                          # Polls socket for data and
> updates scatter collections
>     fig_A.canvas.draw_idle()
>     fig_B.canvas.draw_idle()
>
> plt.waitforbuttonpress()
>
> I have timed the code and found that the first flush_events() call in the
> loop takes 350ms. The second flush_events() call takes <1ms.
> 350ms seems very long and is restricting the update rate.
>
> Why might flush_events() be taking so long?
>
> (I have not changed the backend from the default, which I believe is
> TkAgg).
>
> Best regards
>
> David
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170725/a1ce2f04/attachment.html>


More information about the Matplotlib-users mailing list