def __init__(self, parent, logger): ClassPlot.__init__(self) # store the logger instance self.logger = logger # we do not need caching self.canvas().setPaintAttribute(Qwt.QwtPlotCanvas.PaintCached, False) self.canvas().setPaintAttribute(Qwt.QwtPlotCanvas.PaintPacked, False) # attach a grid grid = Qwt.QwtPlotGrid() grid.setMajPen(Qt.QPen(Qt.Qt.lightGray)) grid.attach(self) xtitle = Qwt.QwtText('Time (ms)') xtitle.setFont(QtGui.QFont(8)) self.setAxisTitle(Qwt.QwtPlot.xBottom, xtitle) self.setAxisScale(Qwt.QwtPlot.yLeft, -1., 1.) # self.setAxisTitle(Qwt.QwtPlot.xBottom, 'Time (ms)') self.xmin = 0. self.xmax = 1. ytitle = Qwt.QwtText('Signal') ytitle.setFont(QtGui.QFont(8)) self.setAxisTitle(Qwt.QwtPlot.yLeft, ytitle) # self.setAxisTitle(Qwt.QwtPlot.yLeft, 'Signal') self.setAxisScale(Qwt.QwtPlot.yLeft, -1., 1.) self.setAxisScaleEngine(Qwt.QwtPlot.xBottom, Qwt.QwtLinearScaleEngine()) self.paint_time = 0. self.canvas_width = 0 self.dual_channel = False # insert an additional curve for the second channel # (ClassPlot already has one by default) self.curve2 = Qwt.QwtPlotCurve("Ch2") self.curve2.setPen(QtGui.QPen(Qt.Qt.blue)) #self.curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) #self.curve2.attach(self) # gives an appropriate title to the first curve # (for the legend) self.curve.setTitle("Ch1") # picker used to display coordinates when clicking on the canvas self.picker = picker(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.ActiveOnly, self.canvas()) self.cached_canvas = self.canvas() #need to replot here for the size Hints to be computed correctly (depending on axis scales...) self.replot()
def __init__(self, parent, logger): ClassPlot.__init__(self) # store the logger instance self.logger = logger # we do not need caching self.canvas().setPaintAttribute(Qwt.QwtPlotCanvas.PaintCached, False) self.canvas().setPaintAttribute(Qwt.QwtPlotCanvas.PaintPacked, False) # attach a grid grid = Qwt.QwtPlotGrid() grid.setMajPen(Qt.QPen(Qt.Qt.lightGray)) grid.attach(self) xtitle = Qwt.QwtText('Time (ms)') xtitle.setFont(QtGui.QFont(8)) self.setAxisTitle(Qwt.QwtPlot.xBottom, xtitle) # self.setAxisTitle(Qwt.QwtPlot.xBottom, 'Time (ms)') ytitle = Qwt.QwtText('Signal') ytitle.setFont(QtGui.QFont(8)) self.setAxisTitle(Qwt.QwtPlot.yLeft, ytitle) # self.setAxisTitle(Qwt.QwtPlot.yLeft, 'Signal') self.setAxisScale(Qwt.QwtPlot.yLeft, -1., 1.) self.setAxisScaleEngine(Qwt.QwtPlot.xBottom, Qwt.QwtLinearScaleEngine()) self.xmax = 0 self.paint_time = 0. self.canvas_width = 0 self.dual_channel = False # insert an additional curve for the second channel # (ClassPlot already has one by default) self.curve2 = Qwt.QwtPlotCurve("Ch2") self.curve2.setPen(QtGui.QPen(Qt.Qt.blue)) #self.curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) #self.curve2.attach(self) # gives an appropriate title to the first curve # (for the legend) self.curve.setTitle("Ch1") # picker used to display coordinates when clicking on the canvas self.picker = picker(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.ActiveOnly, self.canvas()) self.cached_canvas = self.canvas() #need to replot here for the size Hints to be computed correctly (depending on axis scales...) self.replot()
def __init__(self, parent, logger): ClassPlot.__init__(self) # store the logger instance self.logger = logger # we do not need caching self.canvas().setPaintAttribute(Qwt.QwtPlotCanvas.PaintCached, False) self.canvas().setPaintAttribute(Qwt.QwtPlotCanvas.PaintPacked, False) self.ymin = -140. self.setAxisScale(Qwt.QwtPlot.yLeft, self.ymin, 0.) self.baseline_transformed = False self.baseline = 0. self.curve.setBaseline(self.ymin) xtitle = Qwt.QwtText('Frequency (Hz)') xtitle.setFont(QtGui.QFont(8)) self.setAxisTitle(Qwt.QwtPlot.xBottom, xtitle) # self.setAxisTitle(Qwt.QwtPlot.xBottom, 'Frequency (Hz)') ytitle = Qwt.QwtText('PSD (dB A)') ytitle.setFont(QtGui.QFont(8)) self.setAxisTitle(Qwt.QwtPlot.yLeft, ytitle) # self.setAxisTitle(Qwt.QwtPlot.yLeft, 'PSD (dB)') # attach a grid grid = Qwt.QwtPlotGrid() grid.enableXMin(True) grid.setMajPen(Qt.QPen(Qt.QPen(Qt.Qt.gray))) grid.setMinPen(Qt.QPen(Qt.QPen(Qt.Qt.lightGray))) grid.setZ(1000.) grid.attach(self) self.xmax = 0 self.needfullreplot = False self.canvas_width = 0 self.logfreqscale = False self.setfreqrange(20., 20000.) self.setlinfreqscale() self.setAxisScaleDraw(Qwt.QwtPlot.xBottom, FreqScaleDraw()) self.paint_time = 0. # picker used to display coordinates when clicking on the canvas self.picker = picker(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.ActiveOnly, self.canvas()) # insert an additional curve for the peak self.curve_peak = Qwt.QwtPlotCurve() #self.curve_peak.setPen(QtGui.QPen(Qt.Qt.blue)) self.curve_peak.setPen(Qt.QColor("#FF9000")) #dark orange #self.curve_peak.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) #self.curve_peak.setPen(QtGui.QPen(Qt.Qt.NoPen)) #self.curve_peak.setBrush(Qt.Qt.blue) self.curve_peak.attach(self) self.peak = zeros((1,)) self.peakHold = 0 self.peakDecay = PEAK_DECAY_RATE self.peaks_enabled = True # fill under the curve #self.curve.setBrush(Qt.QColor(255,0,190)) #self.curve.setBrush(Qt.Qt.red) self.curve.setBrush(Qt.QColor("#057D9F")) #some sort of blue #self.curve.setPen(Qt.QColor(255,0,0,0)) #self.curve.setPen(QtGui.QPen(Qt.Qt.red)) self.curve.setPen(QtGui.QPen(Qt.Qt.NoPen)) #self.curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) self.cached_canvas = self.canvas() #need to replot here for the size Hints to be computed correctly (depending on axis scales...) self.replot()
def __init__(self, parent, logger): ClassPlot.__init__(self) # store the logger instance self.logger = logger # we do not need caching self.canvas().setPaintAttribute(Qwt.QwtPlotCanvas.PaintCached, False) self.canvas().setPaintAttribute(Qwt.QwtPlotCanvas.PaintPacked, False) self.ymin = -140. self.setAxisScale(Qwt.QwtPlot.yLeft, self.ymin, 0.) self.baseline_transformed = False self.baseline = 0. self.curve.setBaseline(self.ymin) xtitle = Qwt.QwtText('Frequency (Hz)') xtitle.setFont(QtGui.QFont(8)) self.setAxisTitle(Qwt.QwtPlot.xBottom, xtitle) # self.setAxisTitle(Qwt.QwtPlot.xBottom, 'Frequency (Hz)') ytitle = Qwt.QwtText('PSD (dB A)') ytitle.setFont(QtGui.QFont(8)) self.setAxisTitle(Qwt.QwtPlot.yLeft, ytitle) # self.setAxisTitle(Qwt.QwtPlot.yLeft, 'PSD (dB)') # attach a grid grid = Qwt.QwtPlotGrid() grid.enableXMin(True) grid.setMajPen(Qt.QPen(Qt.QPen(Qt.Qt.gray))) grid.setMinPen(Qt.QPen(Qt.QPen(Qt.Qt.lightGray))) grid.setZ(1000.) grid.attach(self) self.xmax = 0 self.needfullreplot = False self.canvas_width = 0 self.logfreqscale = False self.setfreqrange(20., 20000.) self.setlinfreqscale() self.setAxisScaleDraw(Qwt.QwtPlot.xBottom, FreqScaleDraw()) self.paint_time = 0. # picker used to display coordinates when clicking on the canvas self.picker = picker(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.ActiveOnly, self.canvas()) # insert an additional curve for the peak self.curve_peak = Qwt.QwtPlotCurve() #self.curve_peak.setPen(QtGui.QPen(Qt.Qt.blue)) self.curve_peak.setPen(Qt.QColor("#FF9000")) #dark orange #self.curve_peak.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) #self.curve_peak.setPen(QtGui.QPen(Qt.Qt.NoPen)) #self.curve_peak.setBrush(Qt.Qt.blue) self.curve_peak.attach(self) self.peak = zeros((1, )) self.peakHold = 0 self.peakDecay = PEAK_DECAY_RATE self.peaks_enabled = True # fill under the curve #self.curve.setBrush(Qt.QColor(255,0,190)) #self.curve.setBrush(Qt.Qt.red) self.curve.setBrush(Qt.QColor("#057D9F")) #some sort of blue #self.curve.setPen(Qt.QColor(255,0,0,0)) #self.curve.setPen(QtGui.QPen(Qt.Qt.red)) self.curve.setPen(QtGui.QPen(Qt.Qt.NoPen)) #self.curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) self.cached_canvas = self.canvas() #need to replot here for the size Hints to be computed correctly (depending on axis scales...) self.replot()