Thanks for the suggestions! > On May 25, 2021, at 6:24 PM, Martin Chase <[email protected]> wrote: > > Hey Israel, > > A couple of thoughts: > > Downsampling should be able to make things faster. Look at the "optimization" > section in > https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/plotdataitem.html > <https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/plotdataitem.html> I don’t think downsampling is appropriate for my dataset. Since the points are arranged spatially, any *simple* downsampling would result in holes in the data coverage. I could, of course *resample* to a larger grid size, but that would either loose resolution when zoomed in - which we can’t afford, given that the features we are looking for often are only one or two grid cells in size - or require periodic re-resampling depending on the zoom, which doubtless would be more computationally expensive than simply re-drawing the dataset, not to mention complicated to implement.
> QGraphicsItems can be cached, which might help with panning. Docs > https://doc.qt.io/qt-5/qgraphicsitem.html#CacheMode-enum > <https://doc.qt.io/qt-5/qgraphicsitem.html#CacheMode-enum> It seems like this should work, based on the description - in fact, it sounds like it should do essentially what I was suggesting, rendering once to a offscreen pixmap and then simply using that rendered version. Unfortunately, I spent some time playing around with the setCacheMode function as well as the QPixmapCache.setCacheLimit function that the setCacheMode function mentioned, with no noticeable effect. Which suggests to me that I might be doing something wrong. That said, I also spent a bit more time pursuing my original thought of rendering the plot to a single pixmap, then just displaying that single image. As it turned out, once I took a step back from PyQtGraph, implementing this solution using the base Qt classes/functions turned out to be surprisingly simple - simplified, no doubt, by the fact that I was already supplying the symbol brushes to the plot command as a list of QPainterPaths. So I was able to simply take the x and y coordinates, and use a QPainter to directly paint the QPainterPaths into a QPixmap, which could then be added to my plot as a single item. I *did* have to reduce the quality of the rendering a bit to fit things into memory - so if you zoom in far enough, the individual data cells have rough edges - but other than that, it seems to work fine - and performance goes from painfully sluggish on my old machine to silky smooth. There may be other issues with this approach, but so far I haven’t run into any, at least with my specific application. More testing remains. Thanks again! --- Israel Brewster Software Engineer Alaska Volcano Observatory Geophysical Institute - UAF 2156 Koyukuk Drive Fairbanks AK 99775-7320 Work: 907-474-5172 cell: 907-328-9145 > > Others may have more ideas? Let us know if any of that helps! > > - Martin > > -- > You received this message because you are subscribed to the Google Groups > "pyqtgraph" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pyqtgraph/CAD_p8v0iE_jYahUx7o2Oz-u%3DEor8ELyEJK1z53i-3YNvtK-dYw%40mail.gmail.com > > <https://groups.google.com/d/msgid/pyqtgraph/CAD_p8v0iE_jYahUx7o2Oz-u%3DEor8ELyEJK1z53i-3YNvtK-dYw%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "pyqtgraph" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/233ABF09-0EE0-4AC9-90AD-6BB2586D2AD7%40alaska.edu.
