allow unsetting options in PlotDataItem and PlotCurveItem#2041
allow unsetting options in PlotDataItem and PlotCurveItem#2041j9ac9k merged 7 commits intopyqtgraph:masterfrom
Conversation
|
(deleted, discussion in #2039) |
|
So almost all the options are "sticky" options. If you set an option in one call of item = pg.PlotCurveItem(pen='w', brush='b', connect='finite')
item.setData(x, y)The exception is |
|
I can be talked into I'm still partial to that mechanism; but I'm not sure we should have one option behave differently from the others. |
|
@NilsNemitz do you think |
|
Hmm. So far, I always read "skipFiniteCheck" as a hint for just the current dataset. But there is an argument to be made for turning it sticky:
And where that rare case applies, a sticky flag can still be updated with every call. So I think a sticky flag might be better. |
|
|
||
| self.opts['skipFiniteCheck'] = kargs.get('skipFiniteCheck', False) | ||
| if 'skipFiniteCheck' in kargs: | ||
| self.opts['skipFiniteCheck'] = kargs['skipFiniteCheck'] |
There was a problem hiding this comment.
This updates skipFiniteCheck only on request. A default False value will be used if it is never explicitly set.
|
The latest commit should make I have updated the documentation for the logic and effect, and also added some text that explains the recently added handling of wide lines. I would also suggest adding a final one-year expiration period for the long-deprecated options |
| require merging the entire plot into a single entity before the alpha value can be applied. For plots with more | ||
| than a few hundred points, this can result in excessive slowdown. | ||
|
|
||
| Since version 0.12.3, this slowdown is automatically avoided by an algorithm that draws line segments |
There was a problem hiding this comment.
Since 0.12.4 (or whichever version comes after 0.12.3)
| @@ -496,7 +515,10 @@ def updateData(self, *args, **kargs): | |||
| if self.opts['stepMode'] in ("center", True): ## check against True for backwards compatibility | |||
| if self.opts['stepMode'] is True: | |||
| import warnings | |||
There was a problem hiding this comment.
I know you didn't just add this, but would you mind removing this import here given the static code checker is complaining about it?
| by line segments. | ||
|
|
||
| | 'all' (default) indicates full connection. | ||
| | 'pairs' omits even-numbered segments. |
There was a problem hiding this comment.
The previous docs say that even-numbered segments are drawn, presumably counting from zero.
There was a problem hiding this comment.
Hmm. If you naturally start counting from zero, then neither of these descriptions seems particularly helpful.
I would start counting segments from one, and found the previous text confusing.
How about:
" 'pairs' draws one separate line segment for each two points given, starting with the first point. " ?
There was a problem hiding this comment.
I suppose 'pairs' draws one separate line segment for each two points given. would be good enough. Don't think there is any doubt about it starting from the first point.
There was a problem hiding this comment.
Agreed, and changed.
|
Thanks @NilsNemitz you clearly have been busy ...love the documentation updates too 👍🏻 merging. |
…2041) * allow unsetting parameters in PlotDataItem and PlotCurveItem * sticky skipFiniteCheck and documentation updates * can't count * removed duplicate import of wanrings * minor documentation clean-up for PlotCurveItem * clarify pairs parameters
This is a quick attempt to address #2039: Various plotting parameters can be set, but cannot be unset, especially when going through the
PlotDataIteminterfaces.The origin of the problem is that much of the code implicitly assumes that a new element is initialized from zero, and there are explicit checks that cancel out of the update early when parameters are
None.This problem is present in both
PlotDataItemandPlotCurveItem, but the faulty shortcut checks are particularly used in thesetData()methods. I think the problem is worse when going through aPlotDataItem, because this tends to callPlotCurveItem.setData()with any changes,I made a quick pass over the code and removed problematic shortcut checks for
None, as well as unconditionalmkBrush/mkPencalls that prevented setting these to explicit None values.The tests seem to pass, and this seems to address the test cases described in #2039.
But I have probably missed a few things, so some additional testing and feedback would be appreciated!
@pijyoi , do you immediately see anything that this misses?
Closes #2039 ... once it works.