def __init__(self, parent=None): Qwt.QwtPlot.__init__(self, parent ) self.grid=None self.setTitle( "Watching TV during a weekend" ) canvas = Qwt.QwtPlotCanvas() canvas.setPalette( QPalette(Qt.gray) ) canvas.setBorderRadius( 10 ) self.setCanvas( canvas ) self.plotLayout().setAlignCanvasToScales( True ) self.setAxisTitle( Qwt.QwtPlot.yLeft, "Number of People" ) self.setAxisTitle( Qwt.QwtPlot.xBottom, "Number of Hours" ) self.legend = Qwt.QwtLegend() self.legend.setDefaultItemMode( Qwt.QwtLegendData.Checkable ) self.insertLegend( self.legend, Qwt.QwtPlot.RightLegend ) self.populate() self.legend.checked['QVariant','bool','int'].connect(self.showItem ) self.replot() # creating the legend items """self.items = Qwt.QwtPlotDict.itemList( Qwt.QwtPlotItem.Rtti_PlotHistogram ) for i in range(len(self.items)): if ( i == 0 ): #const QVariant itemInfo = itemToInfo( self.items[i] ) #QwtLegendLabel * legendLabel = legend.legendWidget( itemInfo ) if ( legendLabel ): legendLabel.setChecked( True ) self.items[i].setVisible( True ) else: self.items[i].setVisible( False )""" self.setAutoReplot( True )
def __init__(self, parent=None): Qwt.QwtPlot.__init__(self, parent) self.canvas().setStyleSheet( "border: 2px solid Black;" "border-radius: 15px;" "background-color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1," "stop: 0 LemonChiffon, stop: 1 PaleGoldenrod );") # attach curve self.d_curve = Qwt.QwtPlotCurve("Scattered Points") self.d_curve.setPen(QColor("Purple")) # when using QwtPlotCurve.ImageBuffer simple dots can be # rendered in parallel on multicore systems. self.d_curve.setRenderThreadCount( 0) # 0: use QThread.idealThreadCount() self.d_curve.attach(self) self.setSymbol(None) # panning with the left mouse button Qwt.QwtPlotPanner(self.canvas()) # zoom in/out with the wheel #magnifier = Qwt.QwtPlotMagnifier( self.canvas() ) FIXME #magnifier.setMouseButton( Qt.NoButton ) # distanve measurement with the right mouse button self.picker = DistancePicker(self.canvas()) self.picker.setMousePattern(Qwt.QwtPlotPicker.MouseSelect1, Qt.RightButton) self.picker.setRubberBandPen(QPen(Qt.blue))
def __init__(self, parent): Qwt.QwtPlot.__init__(self, parent) self.RGBMap = 0 self.IndexMap = 1 self.HueMap = 2 self.AlphaMap = 3 self.d_alpha = 255 self.d_spectrogram = Qwt.QwtPlotSpectrogram() self.d_spectrogram.setRenderThreadCount( 0) # use system specific thread count self.d_spectrogram.setCachePolicy(Qwt.QwtPlotRasterItem.PaintCache) contourLevels = [] for level in range(1, 20, 2): contourLevels.append(0.5 * level) self.d_spectrogram.setContourLevels(contourLevels) self.d_spectrogram.setData(SpectrogramData()) self.d_spectrogram.attach(self) zInterval = self.d_spectrogram.data().interval(Qt.ZAxis) # A color bar on the right axis self.rightAxis = self.axisWidget(Qwt.QwtPlot.yRight) self.rightAxis.setTitle("Intensity") self.rightAxis.setColorBarEnabled(True) self.setAxisScale(Qwt.QwtPlot.yRight, zInterval.minValue(), zInterval.maxValue()) self.enableAxis(Qwt.QwtPlot.yRight) self.plotLayout().setAlignCanvasToScales(True) self.setColorMap(self.RGBMap) # LeftButton for the zooming # MidButton for the panning # RightButton: zoom out by 1 # Ctrl+RighButton: zoom out to full size self.zoomer = MyZoomer(self.canvas()) self.zoomer.setMousePattern(Qwt.QwtEventPattern.MouseSelect2, Qt.RightButton, Qt.ControlModifier) self.zoomer.setMousePattern(Qwt.QwtEventPattern.MouseSelect3, Qt.RightButton) self.panner = Qwt.QwtPlotPanner(self.canvas()) self.panner.setAxisEnabled(Qwt.QwtPlot.yRight, False) self.panner.setMouseButton(Qt.MidButton) # Avoid jumping when labels with more/less digits # appear/disappear when scrolling vertically fm = QFontMetrics(self.axisWidget(Qwt.QwtPlot.yLeft).font()) sd = self.axisScaleDraw(Qwt.QwtPlot.yLeft) sd.setMinimumExtent(fm.width("100.00")) c = QColor(Qt.darkBlue) self.zoomer.setRubberBandPen(c) self.zoomer.setTrackerPen(c)
def setValues(self, values ): numValues = len(values) #QVector<QwtIntervalSample> samples( numValues ) samples = [] for i in range(numValues): interval = Qwt.QwtInterval( i , i + 1.0 ) interval.setBorderFlags( Qwt.QwtInterval.ExcludeMaximum ) samples.append(Qwt.QwtIntervalSample( values[i], interval )) self.setSamples( samples )
def showPeak(self, freq, amplitude): label = "Peak: %.3g dB" % amplitude text = Qwt.QwtText(label) text.setFont(QFont("Helvetica", 10, QFont.Bold)) text.setColor(QColor(200, 150, 0)) self.d_marker2.setValue(freq, amplitude) self.d_marker2.setLabel(text)
def show3dB(self, freq): label = "-3 dB at f = %.3g" % freq text = Qwt.QwtText(label) text.setFont(QFont("Helvetica", 10, QFont.Bold)) text.setColor(Qt.green) self.d_marker1.setValue(freq, 0.0) self.d_marker1.setLabel(text)
def __init__(self, parent): QWidget.__init__(self, parent ) self.freqMin = 87.5 self.freqMax = 108 self.d_sliderFrequency = Qwt.QwtSlider( self ) self.d_sliderFrequency.setOrientation( Qt.Horizontal ) self.d_sliderFrequency.setScalePosition( Qwt.QwtSlider.TrailingScale ) self.d_sliderFrequency.setScale( self.freqMin, self.freqMax ) #self.d_sliderFrequency.setTotalSteps( math.round( ( self.freqMax - self.freqMin ) / 0.01 ) ) FIXME self.d_sliderFrequency.setTotalSteps( int(math.ceil( ( self.freqMax - self.freqMin ) / 0.01 ) ) ) self.d_sliderFrequency.setSingleSteps( 1 ) self.d_sliderFrequency.setPageSteps( 10 ) self.d_sliderFrequency.setScaleMaxMinor( 5 ) self.d_sliderFrequency.setScaleMaxMajor( 12 ) self.d_sliderFrequency.setHandleSize( QSize( 80, 20 ) ) self.d_sliderFrequency.setBorderWidth( 1 ) self.d_thermoTune = TuningThermo( self ) self.d_wheelFrequency = Qwt.QwtWheel( self ) self.d_wheelFrequency.setMass( 0.5 ) self.d_wheelFrequency.setRange( 87.5, 108 ) self.d_wheelFrequency.setSingleStep( 0.01 ) self.d_wheelFrequency.setPageStepCount( 10 ) self.d_wheelFrequency.setTotalAngle( 3600.0 ) self.d_wheelFrequency.setFixedHeight( 30 ) self.d_wheelFrequency.valueChanged['double'].connect(self.adjustFreq ) self.d_sliderFrequency.valueChanged['double'].connect(self.adjustFreq ) self.mainLayout = QVBoxLayout( self ) #self.mainLayout.setMargin( 10 ) self.mainLayout.setSpacing( 5 ) self.mainLayout.addWidget( self.d_sliderFrequency ) self.hLayout = QHBoxLayout() #self.hLayout.setMargin( 0 ) #self.hLayout.addWidget( self.d_thermoTune, 0 ) self.hLayout.addStretch( 5 ) self.hLayout.addWidget( self.d_wheelFrequency, 2 ) self.mainLayout.addLayout( self.hLayout )
def __init__(self): Curve.__init__(self) self.setPen( QColor( 150, 150, 200 ), 2 ) self.setStyle( Qwt.QwtPlotCurve.Lines ) curveFitter = Qwt.QwtSplineCurveFitter() curveFitter.setSplineSize( 150 ) self.setCurveFitter( curveFitter ) self.setCurveAttribute( Qwt.QwtPlotCurve.Fitted, True ) symbol = Qwt.QwtSymbol( Qwt.QwtSymbol.XCross ) symbol.setPen( Qt.yellow ) symbol.setSize( 7 ) self.setSymbol( symbol ) # somewhere to the left self.transform = QTransform() self.transform.scale( 1.5, 1.0 ); self.transform.translate( 1.5, 3.0 ); self.setTransformation( self.transform )
def __init__(self, parent): QWidget.__init__( self, parent ) self.d_thermo = Qwt.QwtThermo( self ) self.d_thermo.setOrientation( Qt.Horizontal ) self.d_thermo.setScalePosition( Qwt.QwtThermo.NoScale ) self.d_thermo.setScale( 0.0, 1.0 ) self.d_thermo.setFillBrush( Qt.green ) self.label = QLabel( "Tuning", self ) self.label.setAlignment( Qt.AlignCenter ) self.layout = QVBoxLayout( self ) #self.layout.setMargin( 0 ) FIXME self.layout.addWidget( self.d_thermo ) self.layout.addWidget( self.label ) self.setFixedWidth( 3 * self.label.sizeHint().width() )
def __init__( self, title, parent ): QWidget.__init__(self, parent) self.d_thermo = Qwt.QwtThermo( self ) self.d_thermo.setPipeWidth( 6 ) self.d_thermo.setScale( -40, 10 ) self.d_thermo.setFillBrush( Qt.green ) self.d_thermo.setAlarmBrush( Qt.red ) self.d_thermo.setAlarmLevel( 0.0 ) self.d_thermo.setAlarmEnabled( True ) label = QLabel( title, self ) label.setAlignment( Qt.AlignTop | Qt.AlignLeft ) self.layout = QVBoxLayout( self ) #self.layout.setMargin( 0 ) self.layout.setSpacing( 0 ) self.layout.addWidget( self.d_thermo, 10 ) self.layout.addWidget( label )
def __init__(self): Curve.__init__(self) self.setStyle( Qwt.QwtPlotCurve.Lines ) self.setPen( QColor( 100, 200, 150 ), 2 ) curveFitter = Qwt.QwtSplineCurveFitter() curveFitter.setFitMode( Qwt.QwtSplineCurveFitter.ParametricSpline ) curveFitter.setSplineSize( 200 ) self.setCurveFitter( curveFitter ) self.setCurveAttribute( Qwt.QwtPlotCurve.Fitted, True ) # somewhere in the top right corner transform = QTransform() transform.translate( 7.0, 7.5 ) transform.scale( 2.0, 2.0 ) self.setTransformation( transform )
def populate(self): self.grid = Qwt.QwtPlotGrid() self.grid.enableX( False ) self.grid.enableY( True ) self.grid.enableXMin( False ) self.grid.enableYMin( False ) self.grid.setMajorPen( Qt.black, 0, Qt.DotLine ) self.grid.attach( self ) juneValues = [ 7.0, 19.0, 24.0, 32.0, 10.0, 5.0, 3.0 ] novemberValues = [ 4.0, 15.0, 22.0, 34.0, 13.0, 8.0, 4.0 ] histogramJune = Histogram( "Summer", Qt.red ) histogramJune.setValues( juneValues ) histogramJune.attach( self ) histogramNovember = Histogram( "Winter", Qt.blue ) histogramNovember.setValues( novemberValues ) histogramNovember.attach( self )
def mprint(self): printer = QPrinter(QPrinter.HighResolution) docName = "Humm" #self.d_plot.title().text() #if ( not docName.isEmpty() ): #docName.replace ( QRegExp ( QString.fromLatin1 ( "\n" ) ), tr ( " -- " ) ) printer.setDocName(docName) printer.setCreator("Bode example") printer.setOrientation(QPrinter.Landscape) dialog = QPrintDialog(printer) if (dialog.exec_()): renderer = Qwt.QwtPlotRenderer() if (printer.colorMode() == QPrinter.GrayScale): renderer.setDiscardFlag(Qwt.QwtPlotRenderer.DiscardBackground) renderer.setDiscardFlag( Qwt.QwtPlotRenderer.DiscardCanvasBackground) renderer.setDiscardFlag(Qwt.QwtPlotRenderer.DiscardCanvasFrame) renderer.setLayoutFlag(Qwt.QwtPlotRenderer.FrameWithScales) renderer.renderTo(self.d_plot, printer)
def __init__(self, title, min, max, parent ): QWidget.__init__(self, parent) self.d_knob = Qwt.QwtKnob( self ) self.d_knob.setScale( min, max ) self.d_knob.setTotalSteps( 0 ) # disable self.d_knob.setScaleMaxMajor( 10 ) self.d_knob.setKnobStyle( Qwt.QwtKnob.Raised ) self.d_knob.setKnobWidth( 50 ) self.d_knob.setBorderWidth( 2 ) self.d_knob.setMarkerStyle( Qwt.QwtKnob.Notch ) self.d_knob.setMarkerSize( 8 ) self.d_knob.scaleDraw().setTickLength( Qwt.QwtScaleDiv.MinorTick, 4 ) self.d_knob.scaleDraw().setTickLength( Qwt.QwtScaleDiv.MediumTick, 4 ) self.d_knob.scaleDraw().setTickLength( Qwt.QwtScaleDiv.MajorTick, 6 ) self.d_label = QLabel( title, self ) self.d_label.setAlignment( Qt.AlignTop | Qt.AlignHCenter ) self.setSizePolicy( QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding )
def __init__(self, orientation, text, parent, value=0.0): QWidget.__init__(self, parent) self.d_label = QLabel(text, self) self.d_label.setFont(QFont("Helvetica", 10)) self.d_thermo = Qwt.QwtThermo(self) self.d_thermo.setOrientation(orientation) self.d_thermo.setScale(0.0, 100.0) self.d_thermo.setValue(value) self.d_thermo.setFont(QFont("Helvetica", 8)) self.d_thermo.setPipeWidth(6) self.d_thermo.setScaleMaxMajor(6) self.d_thermo.setScaleMaxMinor(5) self.d_thermo.setFillBrush(Qt.darkMagenta) """#if 0 QwtLinearColorMap *colorMap = QwtLinearColorMap( Qt.blue, Qt.red ) colorMap.addColorStop( 0.2, Qt.yellow ) colorMap.addColorStop( 0.3, Qt.cyan ) colorMap.addColorStop( 0.4, Qt.green ) #dcolorMap.addColorStop( 0.5, Qt.magenta ) colorMap.setMode( QwtLinearColorMap.FixedColors ) d_thermo.setColorMap( colorMap ) #endif""" self.layout = QVBoxLayout(self) #self.layout.setMargin( 0 ) self.layout.setSpacing(0) if (orientation == Qt.Horizontal): self.d_label.setAlignment(Qt.AlignCenter) self.d_thermo.setScalePosition(Qwt.QwtThermo.LeadingScale) self.layout.addWidget(self.d_label) self.layout.addWidget(self.d_thermo) else: self.d_label.setAlignment(Qt.AlignRight) self.d_thermo.setScalePosition(Qwt.QwtThermo.TrailingScale) self.layout.addWidget(self.d_thermo, 10, Qt.AlignHCenter) self.layout.addWidget(self.d_label, 0)
def __init__(self): Curve.__init__(self) self.setStyle( Qwt.QwtPlotCurve.Sticks ); self.setPen( QColor( 200, 150, 50 ) ); self.setSymbol( Qwt.QwtSymbol( Qwt.QwtSymbol.Ellipse,QColor( Qt.gray ), QColor( Qt.yellow ), QSize( 5, 5 ) ) )
def __init__(self, canvas): Qwt.QwtPlotPicker.__init__(self, canvas) self.setTrackerMode(Qwt.QwtPicker.ActiveOnly) self.setStateMachine(Qwt.QwtPickerDragLineMachine()) self.setRubberBand(Qwt.QwtPlotPicker.PolygonRubberBand)
def __init__(self, parent=None): Qwt.QwtPlot.__init__(self, parent) self.setAutoReplot(False) self.setTitle("Frequency Response of a Second-Order System") canvas = Qwt.QwtPlotCanvas() canvas.setBorderRadius(10) self.setCanvas(canvas) self.setCanvasBackground(QColor("MidnightBlue")) # legend legend = Qwt.QwtLegend() self.insertLegend(legend, Qwt.QwtPlot.BottomLegend) # grid grid = Qwt.QwtPlotGrid() grid.enableXMin(True) grid.setMajorPen(Qt.white, 0, Qt.DotLine) grid.setMinorPen(Qt.gray, 0, Qt.DotLine) grid.attach(self) # axes self.enableAxis(Qwt.QwtPlot.yRight) self.setAxisTitle(Qwt.QwtPlot.xBottom, "Normalized Frequency") self.setAxisTitle(Qwt.QwtPlot.yLeft, "Amplitude [dB]") self.setAxisTitle(Qwt.QwtPlot.yRight, "Phase [deg]") self.setAxisMaxMajor(Qwt.QwtPlot.xBottom, 6) self.setAxisMaxMinor(Qwt.QwtPlot.xBottom, 9) self.setAxisScaleEngine(Qwt.QwtPlot.xBottom, Qwt.QwtLogScaleEngine()) # curves self.d_curve1 = Qwt.QwtPlotCurve("Amplitude") self.d_curve1.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) self.d_curve1.setPen(Qt.yellow) self.d_curve1.setLegendAttribute(Qwt.QwtPlotCurve.LegendShowLine) self.d_curve1.setYAxis(Qwt.QwtPlot.yLeft) self.d_curve1.attach(self) self.d_curve2 = Qwt.QwtPlotCurve("Phase") self.d_curve2.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) self.d_curve2.setPen(Qt.cyan) self.d_curve2.setLegendAttribute(Qwt.QwtPlotCurve.LegendShowLine) self.d_curve2.setYAxis(Qwt.QwtPlot.yRight) self.d_curve2.attach(self) # marker self.d_marker1 = Qwt.QwtPlotMarker() self.d_marker1.setValue(0.0, 0.0) self.d_marker1.setLineStyle(Qwt.QwtPlotMarker.VLine) self.d_marker1.setLabelAlignment(Qt.AlignRight | Qt.AlignBottom) self.d_marker1.setLinePen(Qt.green, 0, Qt.DashDotLine) self.d_marker1.attach(self) self.d_marker2 = Qwt.QwtPlotMarker() self.d_marker2.setLineStyle(Qwt.QwtPlotMarker.HLine) self.d_marker2.setLabelAlignment(Qt.AlignRight | Qt.AlignBottom) self.d_marker2.setLinePen(QColor(200, 150, 0), 0, Qt.DashDotLine) self.d_marker2.setSymbol( Qwt.QwtSymbol(Qwt.QwtSymbol.Diamond, QColor(Qt.yellow), QColor(Qt.green), QSize(8, 8))) self.d_marker2.attach(self) self.setDamp(0) self.setAutoReplot(True)
def __init__(self, *args): QMainWindow.__init__(self, *args) self.d_plot = Plot(self) margin = 5 self.d_plot.setContentsMargins(margin, margin, margin, 0) self.setContextMenuPolicy(Qt.NoContextMenu) self.d_zoomer = [None, None] self.d_zoomer[0] = Zoomer(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, self.d_plot.canvas()) self.d_zoomer[0].setRubberBand(Qwt.QwtPicker.RectRubberBand) self.d_zoomer[0].setRubberBandPen(QColor(Qt.green)) self.d_zoomer[0].setTrackerMode(Qwt.QwtPicker.ActiveOnly) self.d_zoomer[0].setTrackerPen(QColor(Qt.white)) self.d_zoomer[1] = Zoomer(Qwt.QwtPlot.xTop, Qwt.QwtPlot.yRight, self.d_plot.canvas()) self.d_panner = Qwt.QwtPlotPanner(self.d_plot.canvas()) self.d_panner.setMouseButton(Qt.MidButton) self.d_picker = Qwt.QwtPlotPicker(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.AlwaysOn, self.d_plot.canvas()) self.d_picker.setStateMachine(Qwt.QwtPickerDragPointMachine()) self.d_picker.setRubberBandPen(QColor(Qt.green)) self.d_picker.setRubberBand(Qwt.QwtPicker.CrossRubberBand) self.d_picker.setTrackerPen(QColor(Qt.white)) self.setCentralWidget(self.d_plot) self.toolBar = QToolBar(self) self.btnZoom = QToolButton(self.toolBar) self.btnZoom.setText("Zoom") self.btnZoom.setIcon(QIcon(QPixmap(zoom_xpm))) self.btnZoom.setCheckable(True) self.btnZoom.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.toolBar.addWidget(self.btnZoom) self.btnZoom.toggled.connect(self.enableZoomMode) self.btnPrint = QToolButton(self.toolBar) self.btnPrint.setText("Print") self.btnPrint.setIcon(QIcon(QPixmap(print_xpm))) self.btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.toolBar.addWidget(self.btnPrint) self.btnPrint.clicked.connect(self.mprint) self.btnExport = QToolButton(self.toolBar) self.btnExport.setText("Export") self.btnExport.setIcon(QIcon(QPixmap(print_xpm))) self.btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.toolBar.addWidget(self.btnExport) self.btnExport.clicked.connect(self.exportDocument) self.toolBar.addSeparator() hBox = QWidget(self.toolBar) self.layout = QHBoxLayout(hBox) self.layout.setSpacing(0) self.layout.addWidget(QWidget(hBox), 10) # spacer self.layout.addWidget(QLabel("Damping Factor", hBox), 0) self.layout.addSpacing(10) self.cntDamp = Qwt.QwtCounter(hBox) self.cntDamp.setRange(0.0, 5.0) self.cntDamp.setSingleStep(0.01) self.cntDamp.setValue(0.0) self.layout.addWidget(self.cntDamp, 0) self.toolBar.addWidget(hBox) self.addToolBar(self.toolBar) self.statusBar() self.enableZoomMode(False) self.showInfo("humm") self.cntDamp.valueChanged['double'].connect(self.d_plot.setDamp) self.d_picker.moved.connect(self.moved)
def __init__(self): Qwt.QwtRasterData.__init__(self) self.setInterval(Qt.XAxis, Qwt.QwtInterval(-1.5, 1.5)) self.setInterval(Qt.YAxis, Qwt.QwtInterval(-1.5, 1.5)) self.setInterval(Qt.ZAxis, Qwt.QwtInterval(0.0, 10.0))
#!/usr/bin/python import sys import math #import Qwt from PyQt4 import Qwt from PyQt4.QtCore import Qt, QSize from PyQt4.QtGui import QBrush, QPen, QApplication a = QApplication(sys.argv) plot = Qwt.QwtPlot() plot.setTitle("Plot Demo") plot.setCanvasBackground(Qt.white) plot.insertLegend(Qwt.QwtLegend()) grid = Qwt.QwtPlotGrid() grid.attach(plot) curve = Qwt.QwtPlotCurve() curve.setTitle("Some Points") curve.setPen(Qt.blue, 4) curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased, True) symbol = Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, QBrush(Qt.yellow), QPen(Qt.red, 2), QSize(8, 8)) curve.setSymbol(symbol) #x=np.arange(0,10,0.1) x = [] y = [] for i in range(101):
def updateCurves(self): speed = 2 * 3.14159 / 25000.0 # a cycle every 25 seconds phase = self.d_time.elapsed() * speed for i in range(len(self.d_curves)): self.d_curves[i].updateSamples( phase ) #QApplication a( argc, argv ); if __name__ == '__main__': a = QApplication(sys.argv) plot = Plot() #if USE_OPENGL #canvas = Qwt.QwtPlotGLCanvas() #canvas.setFrameStyle( Qwt.QwtPlotGLCanvas.NoFrame ) #else canvas = Qwt.QwtPlotCanvas(); canvas.setFrameStyle( QFrame.NoFrame ); canvas.setPaintAttribute( Qwt.QwtPlotCanvas.BackingStore, False ) #endif plot.setCanvas( canvas ) plot.setCanvasBackground( QColor( 30, 30, 50 ) ) plot.resize( 400, 400 ) plot.show() sys.exit(a.exec_())