<div dir="ltr"><div>When you say first and second flush_events(), do you mean the first and second iterations, or fig_A and fig_B?<br><br></div>Ben Root<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 21, 2017 at 9:33 AM, David Aldrich <span dir="ltr"><<a href="mailto:David.Aldrich@emea.nec.com" target="_blank">David.Aldrich@emea.nec.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
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.<br>
<br>
My main execution loop is:<br>
<br>
plt.draw()<br>
<br>
while (True):<br>
    fig_A.canvas.flush_events()<br>
    fig_B.canvas.flush_events()<br>
    updatePlots()                          # Polls socket for data and updates scatter collections<br>
    fig_A.canvas.draw_idle()<br>
    fig_B.canvas.draw_idle()<br>
<br>
plt.waitforbuttonpress()<br>
<br>
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.<br>
350ms seems very long and is restricting the update rate.<br>
<br>
Why might flush_events() be taking so long?<br>
<br>
(I have not changed the backend from the default, which I believe is TkAgg).<br>
<br>
Best regards<br>
<br>
David<br>
<br>
______________________________<wbr>_________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/matplotlib-<wbr>users</a><br>
</blockquote></div><br></div>