I have large timestamps that need to be checked visually, so I need a quick scroll tool.
How can I do the fastest scroll of Maplotlib / Pyside?
I know correctly, I added the PySide scroll bar to the MPL metric and updated the x-range of the chart using the set_xlim() method. This is not fast enough, because in the last application I have at least 8 temporary tracks in different subnets, which should all scroll together. The graphic figure is attached .
Is there room for improvement?
Here I am attaching a demo code showing a relatively low scroll. This is a long time, but this is almost the entire boiler room code. An interesting bit (which needs to be improved) is in the xpos_changed() method, where xlimits graphs change.
EDIT: Below I have included some of the micro-optimizations suggested by tcaswell , but the refresh rate is not improved.
from PySide import QtGui, QtCore import pylab as plt import numpy as np N_SAMPLES = 1e6 def test_plot(): time = np.arange(N_SAMPLES)*1e-3 sample = np.random.randn(N_SAMPLES) plt.plot(time, sample, label="Gaussian noise") plt.title("1000s Timetrace \n (use the slider to scroll and the spin-box to set the width)") plt.xlabel('Time (s)') plt.legend(fancybox=True) q = ScrollingToolQT(plt.gcf(), scroll_step=10) return q
source share