You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Zoom rubber band lags in larger window #23968
Zoom rubber band is smooth in small window. But when I increase the size of the window the performance degrades.
Here I have stretched the window across two monitors for illustration.
Code for reproduction
importmatplotlib.pyplotaspltimportnumpyasnp# Data for plottingt=np.arange(0.0, 2.0, 0.01)
s=1+np.sin(2*np.pi*t)
fig, ax=plt.subplots()
ax.plot(t, s)
ax.set(xlabel='time (s)', ylabel='voltage (mV)',
title='About as simple as it gets, folks')
ax.grid()
fig.savefig("test.png")
plt.show()
@anntzer you introduced _unmultiplied_rgba8888_to_premultiplied_argb32 in #11845, and the original issue says maybe it was an issue with qt5.1 and earlier. Given that qt5.2 is now 9 years old do we need to support 5.1 any longer and maybe this function isn't required?
Activity
[-]Zoom rubber band lags in larger window[Bug]: [/-][+][Bug]: Zoom rubber band lags in larger window[/+]QuLogic commentedon Sep 20, 2022
How large is large enough to be slow?
inxp commentedon Sep 21, 2022
The GIF that I posted is a window stretched over two 24" monitors, each having 1920x1080 resolution.
For me, the lag becomes noticeable in a 1920x1080 window.
Note that the same lag does not exist or is very low in the matplotlib 2.2.5 version with the Qt5Agg backend.
There is no lag in TkAgg backend for any window size.
Please try comparing the performance of rubber band in the following code between Matplotlib version 2.2.5 and 3.6.0.
inxp commentedon Dec 11, 2022
Update
On further testing, I found that lag is there even when dragging legends.
So I checked
paintEventfunction inFigureCanvasQTAggof\backends\backend_qtagg.pyThe delay was mainly due to following statement in
_unmultipled_rgba8888_to_premultiplied_argb32function ofcbook\__init__.py_unmultipled_rgba8888_to_premultiplied_argb32function is called bypaintEventfunctionThe function call was added as part of #11845 commit.
On reverting the changes done in commits #11731 and #11845, The lag was gone. Everything is working as expected.
So I think, as window size increases it takes more time for
np.takestatement causing delay between subsequent paints.Am I doing something wrong?
jklymak commentedon Dec 11, 2022
@anntzer you introduced
_unmultiplied_rgba8888_to_premultiplied_argb32in #11845, and the original issue says maybe it was an issue with qt5.1 and earlier. Given that qt5.2 is now 9 years old do we need to support 5.1 any longer and maybe this function isn't required?