Enhancement: [Issue/812]: just pass plotArgs keyword arguments

This commit is contained in:
angulartist 2020-07-19 19:16:07 +02:00
parent ae4483bfaa
commit 58aa9306df
2 changed files with 3 additions and 13 deletions

View File

@ -30,7 +30,7 @@ ma = MetaArray(data, info=[
]},
{'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.
if __name__ == '__main__':

View File

@ -20,18 +20,8 @@ class MultiPlotItem(GraphicsLayout.GraphicsLayout):
self.plots = []
def plot(self, data, **kwargs):
def plot(self, data, **plotArgs):
#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 data.ndim != 2:
@ -48,7 +38,7 @@ class MultiPlotItem(GraphicsLayout.GraphicsLayout):
self.nextRow()
sl = [slice(None)] * 2
sl[ax] = i
pi.plot(data[tuple(sl)], **extraParams)
pi.plot(data[tuple(sl)], **plotArgs)
#self.layout.addItem(pi, i, 0)
self.plots.append((pi, i, 0))
info = ic[ax]['cols'][i]