addLine now accepts 'pos' and 'angle' parameters

The issue and this solution are discussed in issue https://github.com/pyqtgraph/pyqtgraph/issues/70.
This commit is contained in:
2xB 2019-06-20 04:37:09 +02:00 committed by GitHub
parent 6632355719
commit 04baa6eef7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -545,9 +545,9 @@ class PlotItem(GraphicsWidget):
:func:`InfiniteLine.__init__() <pyqtgraph.InfiniteLine.__init__>`.
Returns the item created.
"""
pos = kwds.get('pos', x if x is not None else y)
angle = kwds.get('angle', 0 if x is None else 90)
line = InfiniteLine(pos, angle, **kwds)
kwds['pos'] = kwds.get('pos', x if x is not None else y)
kwds['angle'] = kwds.get('angle', 0 if x is None else 90)
line = InfiniteLine(**kwds)
self.addItem(line)
if z is not None:
line.setZValue(z)