def __init__(self, parent=None): Qwt.QwtPlot.__init__(self) self.setAxisTitle(Qwt.QwtPlot.xBottom, 'Frequency [Hz]') self.setAxisTitle(Qwt.QwtPlot.yLeft, "Power in dBm") self.setCanvasBackground(Qt.Qt.black) self.spectrumCurve = Qwt.QwtPlotCurve("FFT") self.spectrumCurve.attach(self) self.spectrumCurve.setPen(Qt.QPen(Qt.Qt.blue)) self.spectrumCurve.setYAxis(Qwt.QwtPlot.yLeft) self.setAxisScale(Qwt.QwtPlot.xBottom, 0.0, 512.0) self.setAxisScale(Qwt.QwtPlot.yLeft, -140.0, -60.0)
def __init__(self, *args): Qwt.QwtPlot.__init__(self, *args) self.setCanvasBackground(Qt.Qt.white) self.alignScales() # Initialize data self.x = arange(0.0, 100.1, 0.5) self.y = zeros(len(self.x), Float) self.z = zeros(len(self.x), Float) self.setTitle("A Moving QwtPlot Demonstration") self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend) self.curveR = Qwt.QwtPlotCurve("Data Moving Right") self.curveR.attach(self) self.curveL = Qwt.QwtPlotCurve("Data Moving Left") self.curveL.attach(self) self.curveL.setSymbol( Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, Qt.QBrush(), Qt.QPen(Qt.Qt.yellow), Qt.QSize(7, 7))) self.curveR.setPen(Qt.QPen(Qt.Qt.red)) self.curveL.setPen(Qt.QPen(Qt.Qt.blue)) mY = Qwt.QwtPlotMarker() mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop) mY.setLineStyle(Qwt.QwtPlotMarker.HLine) mY.setYValue(0.0) mY.attach(self) self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)") self.setAxisTitle(Qwt.QwtPlot.yLeft, "Values") self.startTimer(50) self.phase = 0.0
def drawBase(self, p): if p.drawLine(self): return None restore = False if p.errCode() == FLStylePainter.ErrCode.IdNotFound: # p.painter().save(Qt.QObject.name()) p.painter().save(self.name()) p.applyTransforms() p.painter().translate(self.xpos1_, self.ypos1_) restore = True linePen = Qt.QPen(self.penColor_, self.penWidth_, self.penStyle_) p.painter().setPen(linePen) p.painter().drawLine(0, 0, self.xpos2_ - self.xpos1_, self.ypos2_ - self.ypos1_) if restore: p.painter().restore()
def setPen(self, color, width, style): if not self.PIC_CHK_D(): return None self.d.pte_.setPen(Qt.QPen(color, width, style))