def pcurve(self, x, y, param, xaxis="bottom", yaxis="left"): """ Make a curve `plot item` based on a `guiqwt.styles.CurveParam` instance (:py:class:`guiqwt.curve.CurveItem` object) Usage:: pcurve(x, y, param) """ curve = CurveItem(param) curve.set_data(x, y) curve.update_params() self.__set_curve_axes(curve, xaxis, yaxis) return curve
def __init__(self, parent, name='Panel', plots=[[['Cold', 1], ['Hot', 1]], [['Antenna', 2], ['Reference', 1]]]): QSplitter.__init__(self, parent) self.parent = parent self.name = name self.plots = [i[0] for o in plots for i in o] # make the name's list flat self.active = None self.evnt = None self.xylim = self.XYlim() # Curve panels (plots) Hsplit = QSplitter(self) plotColumns = [QSplitter(self) for n in plots] for rows, c in zip(plots, plotColumns): c.setOrientation(Qt.Vertical) c.setChildrenCollapsible(False) c.cwidgets = [ self.cplot(c, xlabel=u"\u0394f [MHz]", ylabel="Count", updateWidgets=self.xylim.updateWidgets) for i in rows ] c.plots = [[CurveItem(CurveParam()) for j in range(i[1])] for i in rows] for m, cw in enumerate(c.cwidgets): cw.set_title(rows[m][0]) for p in c.plots[m]: p.set_data([0], [0]) p.parent = cw cw.add_item(p) # cw.set_axis_limits(BasePlot.Y_LEFT,0,1) # cw.set_axis_limits(BasePlot.X_BOTTOM,-750,750) cw.setDefaultAxis([-750, 750, 0, 1]) c.addWidget(cw) Hsplit.addWidget(c) self.addWidget(Hsplit) self.addWidget(self.xylim) self.setOrientation(Qt.Vertical) self.curvePanels = dict( zip(self.plots, sum([c.cwidgets for c in plotColumns], []))) self.curves = dict( zip(self.plots, [i for o in plotColumns for i in o.plots])) for nm in self.plots: for p in self.curves[nm]: p.setPen(QPen(Qt.blue, 1)) plotColumns[0].cwidgets[0].setActive()