Revert temporary line width fix
Whenever the pyqtgraph issue (https://github.com/pyqtgraph/pyqtgraph/issues/533) is revolved, the temporary fix to improve plotting speed by restricting the line width to 1 (https://github.com/pymeasure/pymeasure/pull/494) should be reverted.
Greeting from pyqtgraph land. Fix is merged into master, it will be in the next release. Given the number of projects that asked for this "feature", I'm tempted to do a release sooner than later, but before doing so, I would like to hear if thick lines works for you as you think it should, or if you're stumbling across some edge case.
There are some caveats.
- Line update speed with pens > 1 pixel are still ~4-5x slower than our current 1 pixel or less width (we recently underwent some significant performance improvements with our 1 pixel pen's so even a 4-5x hit would not be that far off from performance in <= 0.12.0
- The pens need to be "solid" style
- The pen color requires alpha to be 1 (no transparency)
- If the pen is > 4 pixels, there is another penalty attached (but it's relatively minor)
Hope this addresses your use case!
I think, we should consider that even with fix in pyqtgraph, linewidth>1 still carry a penalty in performance (4-5 times slower). A possibility is to leave default to 1 and allow users to change it, if they wish
There is another option, and that's to enable the openGL renderer. That one suffers no performance penalty but there are a series of other known issues and PlotCurveItem isn't as feature complete.
Last I checked the openGL renderer was slower than the raster renderer; but that's likely due to pyqtgraph maintainers not knowing much about openGL so we likely have some very inefficient code.
Thanks @j9ac9k for the work and the heads-up!! I've tried the updated master and it indeed works a lot smoother. I'm not entirely sure what the best approach would be, to either leave the linewidth at 1 and add an option to change it, to set the default to 2 (and also add an option to change it), or to do either of the above and by default turn on openGL rendering (I know too little of this matter). I'm inclined to vote for keeping the linewidth at 1 and adding the option to change it and a note that users can turn on openGL.
I'm inclined to vote for keeping the linewidth at 1 and adding the option to change it and a note that users can turn on openGL.
This sounds best to me, too.
My personal recommendation would be you all stick with line width = 1 as a default as well. It's the most performant config for the time being. The enableOpenGL=True variant is not on feature parity with the standard renderer, that we generally don't recommend it unless you know what you're doing (and oddly enough, I don't think any of the currently active maintainers of pyqtgraph know much about openGL, so we would exclude ourselves from that group 😆 ).
Regarding turning on/off OpenGL, we recently attempted to make a toggle for this in one of our benchmarks; once openGL was enabled, we could not disable it in the same instance. The code had no errors, but the refusal to disabling the openGL renderer was silent; I only noticed it when doing profiling and realizing that despite openGL being disabled, we were getting openGL-like performance results.
Thanks for this feedback. I've made a PR to implement it
Thanks for the PR! This issue is in fact not closed, though. Its objective is to revert back to a default line width >1 (or at least reassess if that's the best choice) as soon as a pyqtgraph release is available without the performance problem reported in https://github.com/pyqtgraph/pyqtgraph/issues/533 and solved in https://github.com/pyqtgraph/pyqtgraph/pull/2011 :-) AFAICT this will be pyqtgraph 0.12.4 or above.
FWIW we'll be doing a release fairly soon (within the next two weeks, maybe sooner).
it's been a while but realized I never updated it, but we've had some performant thick lines for some time now. There is still a performance penalty, but it's not bad at all
Some caveats:
https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/graphicsItems/PlotCurveItem.py#L650-L668
- qpen.style() has to be
Qt.PenStyle.SolidLine - qpen.isSolid() has to be True (the Brush style needs to be SolidPattern)
- qpen.color().alphaF() == 1.0 (no transparency is allowed)
- antialias global config needs to be disabled
Let me know if you run into any issues.
Thanks for the follow-up!