Merge pull request #1324 from angulartist/feat/multiplotitem-plot-pen

Pass MultiPlotItem.plot kwargs through to child PlotDataItems
This commit is contained in:
Kenneth Lyons 2020-07-19 13:59:24 -07:00 committed by GitHub
commit fe1a4d90f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 8 deletions

View File

@ -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__':

View File

@ -4,7 +4,6 @@ MultiPlotItem.py - Graphics item used for displaying an array of PlotItems
Copyright 2010 Luke Campagnola Copyright 2010 Luke Campagnola
Distributed under MIT/X11 license. See license.txt for more information. Distributed under MIT/X11 license. See license.txt for more information.
""" """
from numpy import ndarray from numpy import ndarray
from . import GraphicsLayout from . import GraphicsLayout
from ..metaarray import * from ..metaarray import *
@ -18,9 +17,9 @@ class MultiPlotItem(GraphicsLayout.GraphicsLayout):
def __init__(self, *args, **kwds): def __init__(self, *args, **kwds):
GraphicsLayout.GraphicsLayout.__init__(self, *args, **kwds) GraphicsLayout.GraphicsLayout.__init__(self, *args, **kwds)
self.plots = [] self.plots = []
def plot(self, data):
def plot(self, data, **plotArgs):
#self.layout.clear() #self.layout.clear()
if hasattr(data, 'implements') and data.implements('MetaArray'): if hasattr(data, 'implements') and data.implements('MetaArray'):
@ -38,7 +37,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)]) 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]
@ -57,6 +56,3 @@ class MultiPlotItem(GraphicsLayout.GraphicsLayout):
p[0].close() p[0].close()
self.plots = None self.plots = None
self.clear() self.clear()