Enhancement: [Issue/812]: just pass plotArgs keyword arguments
This commit is contained in:
parent
ae4483bfaa
commit
58aa9306df
@ -30,7 +30,7 @@ ma = MetaArray(data, info=[
|
|||||||
]},
|
]},
|
||||||
{'name': 'Time', 'values': linspace(0., 1., 1000), 'units': 's'}
|
{'name': 'Time', 'values': linspace(0., 1., 1000), 'units': 's'}
|
||||||
])
|
])
|
||||||
pw.plot(ma)
|
pw.plot(ma, pen='y')
|
||||||
|
|
||||||
## Start Qt event loop unless running in interactive mode.
|
## Start Qt event loop unless running in interactive mode.
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -20,18 +20,8 @@ class MultiPlotItem(GraphicsLayout.GraphicsLayout):
|
|||||||
self.plots = []
|
self.plots = []
|
||||||
|
|
||||||
|
|
||||||
def plot(self, data, **kwargs):
|
def plot(self, data, **plotArgs):
|
||||||
#self.layout.clear()
|
#self.layout.clear()
|
||||||
# extra plot parameters
|
|
||||||
extraParams = {}
|
|
||||||
|
|
||||||
# if 'pen' provided, add it as an extra param
|
|
||||||
if 'pen' in kwargs:
|
|
||||||
pen = kwargs['pen']
|
|
||||||
if not isinstance(pen, QtGui.QPen):
|
|
||||||
raise TypeError("Keyword argument 'pen' must be an instance of QtGui.QPen")
|
|
||||||
extraParams['pen'] = pen
|
|
||||||
|
|
||||||
|
|
||||||
if hasattr(data, 'implements') and data.implements('MetaArray'):
|
if hasattr(data, 'implements') and data.implements('MetaArray'):
|
||||||
if data.ndim != 2:
|
if data.ndim != 2:
|
||||||
@ -48,7 +38,7 @@ class MultiPlotItem(GraphicsLayout.GraphicsLayout):
|
|||||||
self.nextRow()
|
self.nextRow()
|
||||||
sl = [slice(None)] * 2
|
sl = [slice(None)] * 2
|
||||||
sl[ax] = i
|
sl[ax] = i
|
||||||
pi.plot(data[tuple(sl)], **extraParams)
|
pi.plot(data[tuple(sl)], **plotArgs)
|
||||||
#self.layout.addItem(pi, i, 0)
|
#self.layout.addItem(pi, i, 0)
|
||||||
self.plots.append((pi, i, 0))
|
self.plots.append((pi, i, 0))
|
||||||
info = ic[ax]['cols'][i]
|
info = ic[ax]['cols'][i]
|
||||||
|
Loading…
Reference in New Issue
Block a user