def __init__(self, display, axes, data=None, names=None, **kwargs): self.display = display axisItems = {} o = self.axisOrientation for n, a in enumerate(axes[:2]): a.setOrientation(o[n]) axisItems[o[n]] = a a.setPen() # update colour theme pgPlotWidget.__init__(self, axisItems=axisItems) PyqtgraphgDisplayBase.__init__(self) DisplayWidget.__init__(self, **kwargs) self.view = self.getPlotItem() self.addLegend() self.curves = [] # this is mostly used for fast and easy access to all curve values # within the Automatic-script: self.data = ProxyList() if names is not None and data is not None: #ADD MULTIPLE LAYERS if names is None: c = len(data) names = [None] * c else: c = len(names) if data is None: data = [None] * c for i, (d, n) in enumerate(zip(data, names)): self.addLayer(n, d, pen=(i, c)) #UPDATE CURVE NAMES: display.stack.sigLayerNameChanged.connect( lambda index, txt, self=self: self.curves[index].label.setText(txt ))
def __init__(self, display, axes, data=None, names=None, **kwargs): self.display = display axisItems = {} o = self.axisOrientation for n, a in enumerate(axes[:2]): a.setOrientation(o[n]) axisItems[o[n]] = a a.setPen() # update colour theme pgPlotWidget.__init__(self, axisItems=axisItems) PyqtgraphgDisplayBase.__init__(self) DisplayWidget.__init__(self, **kwargs) self.view = self.getPlotItem() self.addLegend() self.curves = [] # this is mostly used for fast and easy access to all curve values # within the Automatic-script: self.data = ProxyList() if names is not None and data is not None: # ADD MULTIPLE LAYERS if names is None: c = len(data) names = [None] * c else: c = len(names) if data is None: data = [None] * c for i, (d, n) in enumerate(zip(data, names)): self.addLayer(n, d, pen=(i, c)) # UPDATE CURVE NAMES: display.stack.sigLayerNameChanged.connect( lambda index, txt, self=self: self.curves[index].label.setText(txt))
def close(self): self.clear() # free memory try: pgPlotWidget.close(self) except TypeError: pass