本文整理匯總了Python中PyQt4.Qwt5.QwtPlot.setAutoFillBackground方法的典型用法代碼示例。如果您正苦於以下問題:Python QwtPlot.setAutoFillBackground方法的具體用法?Python QwtPlot.setAutoFillBackground怎麽用?Python QwtPlot.setAutoFillBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.Qwt5.QwtPlot
的用法示例。
在下文中一共展示了QwtPlot.setAutoFillBackground方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ValueWidget
# 需要導入模塊: from PyQt4.Qwt5 import QwtPlot [as 別名]
# 或者: from PyQt4.Qwt5.QwtPlot import setAutoFillBackground [as 別名]
class ValueWidget(QWidget, Ui_Widget):
def __init__(self, iface):
self.hasqwt=hasqwt
self.hasmpl=hasmpl
self.layerMap=dict()
self.statsChecked=False
self.ymin=0
self.ymax=250
self.isActive=False
# Statistics (>=1.9)
self.statsSampleSize = 2500000
self.stats = {} # stats per layer
self.layersSelected=[]
self.layerBands=dict()
self.iface=iface
self.canvas=self.iface.mapCanvas
self.legend=self.iface.legendInterface()
self.logger = logging.getLogger('.'.join((__name__,
self.__class__.__name__)))
QWidget.__init__(self)
self.setupUi(self)
self.tabWidget.setEnabled(False)
self.cbxClick.setChecked( QSettings().value('plugins/valuetool/mouseClick', False, type=bool ) )
#self.setupUi_plot()
#don't setup plot until Plot tab is clicked - workaround for bug #7450
#qgis will still crash in some cases, but at least the tool can be used in Table mode
self.qwtPlot = None
self.mplPlot = None
self.mplLine = None
QObject.connect(self.plotSelector, SIGNAL( "currentIndexChanged ( int )" ), self.changePlot )
QObject.connect(self.tabWidget, SIGNAL( "currentChanged ( int )" ), self.tabWidgetChanged )
QObject.connect(self.cbxLayers, SIGNAL( "currentIndexChanged ( int )" ), self.updateLayers )
QObject.connect(self.cbxBands, SIGNAL( "currentIndexChanged ( int )" ), self.updateLayers )
QObject.connect(self.tableWidget2, SIGNAL("cellChanged ( int , int )"), self.layerSelected)
def setupUi_plot(self):
# plot
self.plotSelector.setVisible( False )
self.cbxStats.setVisible( False )
# stats by default because estimated are fast
self.cbxStats.setChecked( True )
self.plotSelector.addItem( 'Qwt' )
self.plotSelector.addItem( 'mpl' )
# Page 2 - qwt
if self.hasqwt:
self.qwtPlot = QwtPlot(self.stackedWidget)
self.qwtPlot.setAutoFillBackground(False)
self.qwtPlot.setObjectName("qwtPlot")
self.curve = QwtPlotCurve()
self.curve.setSymbol(
QwtSymbol(QwtSymbol.Ellipse,
QBrush(Qt.white),
QPen(Qt.red, 2),
QSize(9, 9)))
self.curve.attach(self.qwtPlot)
else:
self.qwtPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.qwtPlot.sizePolicy().hasHeightForWidth())
self.qwtPlot.setSizePolicy(sizePolicy)
self.qwtPlot.updateGeometry()
self.stackedWidget.addWidget(self.qwtPlot)
#Page 3 - matplotlib
self.mplLine = None #make sure to invalidate when layers change
if self.hasmpl:
# mpl stuff
# should make figure light gray
self.mplBackground = None #http://www.scipy.org/Cookbook/Matplotlib/Animations
self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
self.mplFig.subplots_adjust(left=0.1, right=0.975, bottom=0.13, top=0.95)
self.mplPlt = self.mplFig.add_subplot(111)
self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)
# qt stuff
self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
self.pltCanvas.setParent(self.stackedWidget)
self.pltCanvas.setAutoFillBackground(False)
self.pltCanvas.setObjectName("mplPlot")
self.mplPlot = self.pltCanvas
else:
self.mplPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.mplPlot.sizePolicy().hasHeightForWidth())
#.........這裏部分代碼省略.........
示例2: ValueWidget
# 需要導入模塊: from PyQt4.Qwt5 import QwtPlot [as 別名]
# 或者: from PyQt4.Qwt5.QwtPlot import setAutoFillBackground [as 別名]
class ValueWidget(QWidget, Ui_Widget):
def __init__(self, iface):
self.hasqwt=hasqwt
self.hasmpl=hasmpl
self.layerMap=dict()
self.statsChecked=False
self.ymin=0
self.ymax=250
self.iface=iface
self.canvas=self.iface.mapCanvas()
self.legend=self.iface.legendInterface()
self.logger = logging.getLogger('.'.join((__name__,
self.__class__.__name__)))
QWidget.__init__(self)
self.setupUi(self)
self.setupUi_extra()
QObject.connect(self.cbxActive,SIGNAL("stateChanged(int)"),self.changeActive)
QObject.connect(self.cbxGraph,SIGNAL("stateChanged(int)"),self.changePage)
QObject.connect(self.canvas, SIGNAL( "keyPressed( QKeyEvent * )" ), self.pauseDisplay )
QObject.connect(self.plotSelector, SIGNAL( "currentIndexChanged ( int )" ), self.changePlot )
def setupUi_extra(self):
# checkboxes
#self.changeActive(Qt.Checked)
#set inactive by default - should save last state in user config
self.cbxActive.setCheckState(Qt.Unchecked)
# plot
self.plotSelector.setVisible( False )
self.cbxStats.setVisible( False )
self.graphControls.setVisible( False )
if self.hasqwt:
self.plotSelector.addItem( 'Qwt' )
if self.hasmpl:
self.plotSelector.addItem( 'mpl' )
self.plotSelector.setCurrentIndex( 0 );
if (not self.hasqwt or not self.hasmpl):
#self.plotSelector.setVisible(False)
self.plotSelector.setEnabled(False)
# Page 2 - qwt
if self.hasqwt:
self.qwtPlot = QwtPlot(self.stackedWidget)
self.qwtPlot.setAutoFillBackground(False)
self.qwtPlot.setObjectName("qwtPlot")
self.curve = QwtPlotCurve()
self.curve.setSymbol(
QwtSymbol(QwtSymbol.Ellipse,
QBrush(Qt.white),
QPen(Qt.red, 2),
QSize(9, 9)))
self.curve.attach(self.qwtPlot)
self.qwtPlot.setVisible(False)
else:
self.qwtPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.qwtPlot.sizePolicy().hasHeightForWidth())
self.qwtPlot.setSizePolicy(sizePolicy)
self.qwtPlot.setObjectName("qwtPlot")
self.qwtPlot.updateGeometry()
self.stackedWidget.addWidget(self.qwtPlot)
#Page 3 - matplotlib
self.mplLine = None #make sure to invalidate when layers change
if self.hasmpl:
# mpl stuff
# should make figure light gray
self.mplBackground = None #http://www.scipy.org/Cookbook/Matplotlib/Animations
self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
self.mplFig.subplots_adjust(left=0.1, right=0.975, bottom=0.13, top=0.95)
self.mplPlt = self.mplFig.add_subplot(111)
self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)
# qt stuff
self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
self.pltCanvas.setParent(self.stackedWidget)
self.pltCanvas.setAutoFillBackground(False)
self.pltCanvas.setObjectName("mplPlot")
self.mplPlot = self.pltCanvas
self.mplPlot.setVisible(False)
else:
self.mplPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.mplPlot.sizePolicy().hasHeightForWidth())
self.mplPlot.setSizePolicy(sizePolicy)
self.qwtPlot.setObjectName("qwtPlot")
self.mplPlot.updateGeometry()
self.stackedWidget.addWidget(self.mplPlot)
#.........這裏部分代碼省略.........
示例3: Ui_MainWindow
# 需要導入模塊: from PyQt4.Qwt5 import QwtPlot [as 別名]
# 或者: from PyQt4.Qwt5.QwtPlot import setAutoFillBackground [as 別名]
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(847, 480)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.centralwidget)
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
#Tworzenie zakładek
self.tabs = QtGui.QTabWidget(self.centralwidget)
#Główny wykre
self.plot = QwtPlot(self.centralwidget)
self.plot.setObjectName(_fromUtf8("plot"))
self.plot.setAxisScale(self.plot.yLeft, -20, 80)
self.plot.setAutoFillBackground(True)
#self.plot.setPalette(Qt.Qt.black)
self.plot.setCanvasBackground(Qt.Qt.black)
self.grid = QwtPlotGrid()
'''self.Yscale = QwtScaleDiv()
self.Yscale.setInterval(10)
self.Xscale = QwtScaleDiv()
self.Xscale.setInterval(10)
self.grid.setYDiv(self.YScale)
self.grid.setXDiv(self.Xscale)'''
self.grid.setMajPen(Qt.Qt.gray)
self.grid.attach(self.plot)
self.tabs.addTab(self.plot, "Spectrum")
self.curve = QwtPlotCurve('')
self.curve.setPen(Qt.Qt.yellow)
self.curve.attach(self.plot)
self.hold_curve = QwtPlotCurve('')
self.hold_curve.setPen(Qt.Qt.red)
self.peak_marker = QwtPlotMarker()
self.symbol = QwtSymbol(QwtSymbol.DTriangle, QtGui.QBrush(Qt.Qt.red), QtGui.QPen(Qt.Qt.red), QtCore.QSize(10,10))
self.peak_marker.setSymbol(self.symbol)
self.peak_marker.setLabelAlignment(Qt.Qt.AlignTop)
self.sybmol_2 = QwtSymbol(QwtSymbol.DTriangle, QtGui.QBrush(Qt.Qt.red), QtGui.QPen(Qt.Qt.white), QtCore.QSize(10,10))
self.marker_1 = QwtPlotMarker()
self.marker_1.setSymbol(self.sybmol_2)
self.marker_1.setLabelAlignment(Qt.Qt.AlignTop)
self.marker_2 = QwtPlotMarker()
self.marker_2.setSymbol(self.sybmol_2)
self.marker_2.setLabelAlignment(Qt.Qt.AlignTop)
self.marker_3 = QwtPlotMarker()
self.marker_3.setSymbol(self.sybmol_2)
self.marker_3.setLabelAlignment(Qt.Qt.AlignTop)
self.marker_4 = QwtPlotMarker()
self.marker_4.setSymbol(self.sybmol_2)
self.marker_4.setLabelAlignment(Qt.Qt.AlignTop)
self.delta_marker = QwtPlotMarker()
self.delta_marker.setSymbol(self.sybmol_2)
self.delta_marker.setLabelAlignment(Qt.Qt.AlignTop)
self.markers = [self.marker_1, self.marker_2, self.marker_3, self.marker_4]
self.save_curve_1 = QwtPlotCurve('')
self.save_curve_1.setPen(Qt.Qt.green)
self.save_curve_2 = QwtPlotCurve('')
self.save_curve_2.setPen(Qt.Qt.cyan)
self.save_curve_3 = QwtPlotCurve('')
self.save_curve_3.setPen(Qt.Qt.magenta)
self.saved_curves = [self.save_curve_1, self.save_curve_2, self.save_curve_3]
#Wykres waterfall
'''self.plot_2 = QwtPlot(self.centralwidget)
self.plot_2.setObjectName(_fromUtf8("plot_2"))
self.waterfall = QwtPlotSpectrogram()
self.waterfall.attach(self.plot_2)
self.colorMap = QwtLinearColorMap(Qt.Qt.darkCyan, Qt.Qt.red)
self.scaleColors(80)
self.waterfall.setColorMap(self.colorMap)
#self.waterfallData = QwtRasterData()
#self.tabs.addTab(self.plot_2, "Waterfall")'''
self.verticalLayout.addWidget(self.tabs)
self.picker = QwtPlotPicker(QwtPlot.xBottom,
QwtPlot.yLeft,
QwtPicker.PointSelection | QwtPicker.DragSelection,
QwtPlotPicker.CrossRubberBand,
QwtPicker.AlwaysOn,
self.plot.canvas())
self.picker.setTrackerPen(Qt.Qt.white)
self.picker.setRubberBandPen(Qt.Qt.gray)
self.freqBox = QtGui.QGroupBox(self.centralwidget)
self.freqBox.setObjectName(_fromUtf8("freqBox"))
self.verticalLayout_3 = QtGui.QVBoxLayout(self.freqBox)
#.........這裏部分代碼省略.........