def setupUi(self, W_seg_sat): W_seg_sat.setObjectName(_fromUtf8("W_seg_sat")) W_seg_sat.resize(349, 358) self.TW_Sat_paso = QtGui.QTabWidget(W_seg_sat) self.TW_Sat_paso.setGeometry(QtCore.QRect(0, 0, 351, 301)) self.TW_Sat_paso.setObjectName(_fromUtf8("TW_Sat_paso")) self.tab_datos = QtGui.QWidget() self.tab_datos.setObjectName(_fromUtf8("tab_datos")) self.TW_seg_sat = QtGui.QTableWidget(self.tab_datos) self.TW_seg_sat.setGeometry(QtCore.QRect(0, 0, 351, 271)) self.TW_seg_sat.setObjectName(_fromUtf8("TW_seg_sat")) self.TW_seg_sat.setColumnCount(0) self.TW_seg_sat.setRowCount(0) self.TW_Sat_paso.addTab(self.tab_datos, _fromUtf8("")) self.tab_A_E = QtGui.QWidget() self.tab_A_E.setObjectName(_fromUtf8("tab_A_E")) self.QP_AE =Qwt.QwtPlot(self.tab_A_E) self.QP_AE.setGeometry(QtCore.QRect(0, 0, 341, 261)) self.QP_AE.setObjectName(_fromUtf8("QP_AE")) self.TW_Sat_paso.addTab(self.tab_A_E, _fromUtf8("")) self.tab_polar = QtGui.QWidget() self.tab_polar.setObjectName(_fromUtf8("tab_polar")) self.QP_P = Qwt.QwtPlot(self.tab_polar) self.QP_P.setGeometry(QtCore.QRect(0, 0, 341, 261)) self.QP_P.setObjectName(_fromUtf8("QP_P")) self.TW_Sat_paso.addTab(self.tab_polar, _fromUtf8("")) self.retranslateUi(W_seg_sat) self.TW_Sat_paso.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(W_seg_sat)
def __init__(self,regs=None): QtGui.QWidget.__init__(self) self.setGeometry(300, 300, 1000, 600) self.setWindowTitle('qgui') self.fig1=Qwt5.QwtPlot() self.fig1.setParent(self) self.fig1.setGeometry(300,0,400,300) self.fig2=Qwt5.QwtPlot() self.fig2.setParent(self) self.fig2.setGeometry(300,300,400,300) self.curves1=[] self.curves2=[] pens=[QtCore.Qt.red, QtCore.Qt.black, QtCore.Qt.cyan, QtCore.Qt.darkCyan, QtCore.Qt.darkRed, QtCore.Qt.magenta, QtCore.Qt.darkMagenta, QtCore.Qt.green, QtCore.Qt.darkGreen, QtCore.Qt.yellow, QtCore.Qt.darkYellow, QtCore.Qt.blue, QtCore.Qt.darkBlue, QtCore.Qt.gray, QtCore.Qt.darkGray, QtCore.Qt.lightGray] for index in range(16): #up to 16 curves here self.curves1.append(Qwt5.QwtPlotCurve()) self.curves1[index].attach(self.fig1) self.curves1[index].setPen(QtGui.QPen(pens[index])) self.curves2.append(Qwt5.QwtPlotCurve()) self.curves2[index].attach(self.fig2) self.curves2[index].setPen(QtGui.QPen(pens[index])) self.layout = QtGui.QVBoxLayout(self) self.layout.setContentsMargins(0,0,0,0) self.layout.setSpacing(0) self.slider={} self.param={} index=0 for reg in regs: self.slider[index]=param_slider(self,name=reg.name,process=self.test1,y0=index*30,init=reg.value,s_min=reg.min_value,s_max=reg.max_value) self.param[reg.name]=reg.value #self.slider[index].connect(self.test1) #print self.slider[index],index #self.layout.addWidget(self.slider[index]) index=index+1 print self.param self.socket = eth_test.setup_sock() write=write_thread(self.param,self.socket)#self.sender().addr,self.sender().value) write.start() self.read=read_and_plot_thread(self.socket) self.read.signal_got_new_data.connect(self.replot) self.read.start()
def __init__(self, *args): QtGui.QMainWindow.__init__(self, *args) self.demo = IzhikevichDemo() self.signalMapper = QtCore.QSignalMapper(self) self.demoFrame = QtGui.QFrame(self) self.controlPanel = QtGui.QFrame(self.demoFrame) self.figureNo = {} self.buttons = {} for key, value in list(IzhikevichDemo.parameters.items()): button = QtGui.QPushButton(key, self.controlPanel) self.figureNo[value[0]] = key self.buttons[key] = button keys = list(self.figureNo.keys()) keys.sort() length = len(keys) rows = int(numpy.rint(numpy.sqrt(length))) cols = int(numpy.ceil(length * 1.0 / rows)) layout = QtGui.QGridLayout() for ii in range(rows): for jj in range(cols): index = ii * cols + jj if index < length: key = self.figureNo[keys[index]] button = self.buttons[key] button.setToolTip(self.tr(IzhikevichDemo.documentation[key])) layout.addWidget(button, ii, jj) self.connect(button, QtCore.SIGNAL('clicked()'), self.signalMapper, QtCore.SLOT('map()')) self.signalMapper.setMapping(button, key) self.connect(self.signalMapper, QtCore.SIGNAL('mapped(const QString &)'), self._simulateAndPlot) self.controlPanel.setLayout(layout) self.plotPanel = QtGui.QFrame(self.demoFrame) self.VmPlot = Qwt.QwtPlot(self.plotPanel) self.VmPlot.setAxisTitle(Qwt.QwtPlot.xBottom, 'time (ms)') self.VmPlot.setAxisTitle(Qwt.QwtPlot.yLeft, 'Vm (mV)') self.VmPlot.replot() self.ImPlot = Qwt.QwtPlot(self.plotPanel) self.ImPlot.setAxisTitle(Qwt.QwtPlot.xBottom, 'time (ms)') self.ImPlot.setAxisTitle(Qwt.QwtPlot.yLeft, 'Im (nA)') self.vmPlotZoomer = self._make_zoomer(self.VmPlot) self.imPlotZoomer = self._make_zoomer(self.ImPlot) self.descriptionWidget = QtGui.QLabel('Click any of the buttons to simulate and plot the corresponding neuron.') self.descriptionWidget.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Sunken) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.descriptionWidget.setSizePolicy(sizePolicy) self.VmPlot.setSizePolicy(sizePolicy) self.ImPlot.setSizePolicy(sizePolicy) layout = QtGui.QVBoxLayout() layout.addWidget(self.VmPlot) layout.addWidget(self.ImPlot) layout.addWidget(self.descriptionWidget) self.plotPanel.setLayout(layout) layout = QtGui.QVBoxLayout() layout.addWidget(self.plotPanel) layout.addWidget(self.controlPanel) self.demoFrame.setLayout(layout) self.setCentralWidget(self.demoFrame)
def initControls(self): self.plot3 = Qwt.QwtPlot(self) self.plot3.setCanvasBackground(Qt.white) self.plot3.enableAxis(Qwt.QwtPlot.yLeft, False) self.plot3.enableAxis(Qwt.QwtPlot.xBottom, False) self.plot1 = Qwt.QwtPlot(self) self.plot1.setCanvasBackground(Qt.white) self.plot2 = Qwt.QwtPlot(self) self.plot2.setCanvasBackground(Qt.white) library_label = QLabel("MS in mass spectra Library:") self.library_list = QTreeWidget() self.library_list.setColumnCount(3) self.library_list.setHeaderLabels( ['No.', 'Similarity', 'Mol Wt', 'Formula', 'Name']) self.library_list.setSortingEnabled(False) self.connect(self.library_list, SIGNAL("itemSelectionChanged()"), self.libraryListClicked) self.connect(self.library_list, SIGNAL("itemActivated (QTreeWidgetItem *,int)"), self.libraryListDoubleClicked) mxiture_label = QLabel("Molecular structure :") # self.mixture_list = QListWidget() okButton = QPushButton("&Search") self.connect(okButton, SIGNAL("clicked()"), self.Seach) left_vbox = QVBoxLayout() left_vbox.addWidget(self.plot1) left_vbox.addWidget(self.plot2) right_vbox = QVBoxLayout() right_vbox.addWidget(library_label) right_vbox.addWidget(self.library_list) hboxPercent = QHBoxLayout() # hboxPercent.addWidget(percent_label) # hboxPercent.addWidget(self.edit_percent) right_vbox.addLayout(hboxPercent) # right_vbox.addWidget(self.add_button) right_vbox.addWidget(mxiture_label) right_vbox.addWidget(self.plot3) right_vbox.addWidget(okButton) hbox = QHBoxLayout() hbox.addLayout(left_vbox, 2.5) hbox.addLayout(right_vbox, 1.5) self.setLayout(hbox)
def initControls(self): self.plot1 = Qwt.QwtPlot(self) self.plot1.setCanvasBackground(Qt.white) self.plot2 = Qwt.QwtPlot(self) self.plot2.setCanvasBackground(Qt.white) self.list = QTreeWidget() self.list.setColumnCount(11) self.list.setColumnWidth(0,80) self.list.setColumnWidth(1,80) self.list.setColumnWidth(2,60) self.list.setColumnWidth(3,60) self.list.setColumnWidth(4,60) self.list.setColumnWidth(5,150) self.list.setColumnWidth(7,30) self.list.setColumnWidth(8,30) self.list.setColumnWidth(9,30) self.list.setColumnWidth(10,30) self.list.setHeaderLabels(['Mass','Calc.Mass','mDa','PPM','DBE','Formula','Fit Conf %','C','H','N','O']) self.list.setSortingEnabled(True) self.table = QTableWidget(1,11) self.table.setColumnWidth(0,80) self.table.setColumnWidth(1,80) self.table.setColumnWidth(2,60) self.table.setColumnWidth(3,60) self.table.setColumnWidth(4,60) self.table.setColumnWidth(5,150) self.table.setColumnWidth(7,30) self.table.setColumnWidth(8,30) self.table.setColumnWidth(9,30) self.table.setColumnWidth(10,30) self.table.setHorizontalHeaderLabels(['Mass','Calc.Mass','mDa','PPM','DBE','Formula','Fit Conf %','C','H','N','O']) self.table.setEditTriggers(QTableWidget.NoEditTriggers) self.table.setSelectionBehavior(QTableWidget.SelectRows) self.table.setSelectionMode(QTableWidget.SingleSelection) self.table.setAlternatingRowColors(True) print self.connect(self.table, SIGNAL("itemActivated(QTableWidgetItem*)"), self.tableClicked) # self.connect(self.library_list, SIGNAL("itemSelectionChanged()"), self.libraryListClicked) up_hbox=QVBoxLayout() up_hbox.addWidget(self.table) down_hbox = QVBoxLayout() down_hbox.addWidget(self.plot1) down_hbox.addWidget(self.plot2) hbox = QVBoxLayout() hbox.addLayout(up_hbox, 3.5) hbox.addLayout(down_hbox, 3.5) self.setLayout(hbox) self.cal_mass()
def plot_production_by_state(): """Show data in qwt plot""" plot = Qwt.QwtPlot() plot.setTitle("Oil Production by State") plot.setAxisTitle(Qwt.QwtPlot.xBottom, "Date") plot.setAxisTitle(Qwt.QwtPlot.yLeft, "Barrels (in thousands)") # Need custom scale to set labels to month/year plot.setAxisScaleDraw(Qwt.QwtPlot.xBottom, view.TimeScaleDraw()) hdf5 = tables.openFile(model.HDF5_FILENAME) x_vals = hdf5.root.data.production_by_state_month.cols.date[:] la_vals = hdf5.root.data.production_by_state_month.cols.la_barrels[:] tx_vals = hdf5.root.data.production_by_state_month.cols.tx_barrels[:] ak_vals = hdf5.root.data.production_by_state_month.cols.ak_barrels[:] ca_vals = hdf5.root.data.production_by_state_month.cols.ca_barrels[:] curve = view.create_curve('La', x_vals, la_vals, QtCore.Qt.green) curve.attach(plot) curve = view.create_curve('Tx', x_vals, tx_vals, QtCore.Qt.blue) curve.attach(plot) curve = view.create_curve('Ak', x_vals, ak_vals, QtCore.Qt.red) curve.attach(plot) curve = view.create_curve('Ca', x_vals, ca_vals, QtCore.Qt.yellow) curve.attach(plot) plot.insertLegend(Qwt.QwtLegend()) plot.replot() return plot
def plot_production_by_month(): """Show data in qwt plot""" plot = Qwt.QwtPlot() plot.setTitle("Oil Production for USA by Month") plot.setAxisTitle(Qwt.QwtPlot.xBottom, "Date") plot.setAxisTitle(Qwt.QwtPlot.yLeft, "Barrels (in thousands)") # Need custom scale to set labels to month/year plot.setAxisScaleDraw(Qwt.QwtPlot.xBottom, view.TimeScaleDraw()) hdf5 = tables.openFile(model.HDF5_FILENAME) x_vals = [] y_vals = [] for row in hdf5.root.data.production_by_month: y_vals.append(row[0]) x_vals.append(row[1]) curve = Qwt.QwtPlotCurve("Barrels (in thousands)") curve.attach(plot) curve.setData(x_vals, y_vals) plot.replot() return plot
def create_plot2(self): self.Trigger2 = 0 self.MaxSamplesPlot2 = 6000 plot2 = Qwt.QwtPlot(self) plot2.setCanvasBackground(Qt.black) plot2.setAxisTitle(Qwt.QwtPlot.xBottom, '') plot2.setAxisScale(Qwt.QwtPlot.xBottom, 0, 60, 5) plot2.setAxisTitle(Qwt.QwtPlot.yLeft, 'Temperature [degC]') plot2.setAxisAutoScale(Qwt.QwtPlot.yLeft) plot2.replot() curve2 = [None] * 3 pen = [ QPen(QColor('limegreen')), QPen(QColor('red')), QPen(QColor('magenta')) ] for i in range(3): curve2[i] = Qwt.QwtPlotCurve('') curve2[i].setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) pen[i].setWidth(2) curve2[i].setPen(pen[i]) curve2[i].attach(plot2) return plot2, curve2
def __init__(self, states, parent=None): """init""" super(StateProductionDialog, self).__init__(parent) self._plot = Qwt.QwtPlot() self._plot.setCanvasBackground(QtCore.Qt.white) self._plot.setTitle("Oil Production by State") self._plot.setAxisTitle(Qwt.QwtPlot.xBottom, "Date") self._plot.setAxisTitle(Qwt.QwtPlot.yLeft, "Barrels (in thousands)") self._plot.insertLegend(Qwt.QwtLegend()) # Need custom scale to set labels to month/year self._plot.setAxisScaleDraw(Qwt.QwtPlot.xBottom, TimeScaleDraw()) self._curves = {} colors = [ QtCore.Qt.green, QtCore.Qt.black, QtCore.Qt.blue, QtCore.Qt.red ] for color, st in izip_longest(colors, states, fillvalue=QtCore.Qt.red): self._curves[st] = create_curve(st, color) self._curves[st].attach(self._plot) vlayout = QtGui.QVBoxLayout() vlayout.setMargin(0) vlayout.addWidget(self._plot) self.setLayout(vlayout) self.setWindowTitle('Oil production by state')
def __init__(self, *args): Qt.QWidget.__init__(self, *args) layout = Qt.QGridLayout(self) # try to create a plot for SciPy arrays try: # import does_not_exist import numpy # make a curve and copy the data numpy_curve = Qwt.QwtPlotCurve('y = lorentzian(x)') x = numpy.arange(0.0, 10.0, 0.01) y = lorentzian(x) numpy_curve.setData(x, y) # here, we know we can plot NumPy arrays numpy_plot = Qwt.QwtPlot(self) numpy_plot.setTitle('numpy array') numpy_plot.setCanvasBackground(Qt.Qt.white) numpy_plot.plotLayout().setCanvasMargin(0) numpy_plot.plotLayout().setAlignCanvasToScales(True) # insert a curve and make it red numpy_curve.attach(numpy_plot) numpy_curve.setPen(Qt.QPen(Qt.Qt.red)) layout.addWidget(numpy_plot, 0, 0) numpy_plot.replot() except ImportError, message: print "%s: %s" % (ImportError, message) print "Install NumPy to plot plot NumPy arrays"
def make(): # create a plot with a white canvas demo = Qwt.QwtPlot(Qwt.QwtText("Errorbar Demonstation")) demo.setCanvasBackground(Qt.Qt.white) demo.plotLayout().setAlignCanvasToScales(True) grid = Qwt.QwtPlotGrid() grid.attach(demo) grid.setPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine)) # calculate data and errors for a curve with error bars x = arange(0, 10.1, 0.5, Float) y = sin(x) dy = 0.2 * abs(y) # dy = (0.15 * abs(y), 0.25 * abs(y)) # uncomment for asymmetric error bars dx = 0.2 # all error bars the same size errorOnTop = False # uncomment to draw the curve on top of the error bars # errorOnTop = True # uncomment to draw the error bars on top of the curve curve = ErrorBarPlotCurve( x=x, y=y, dx=dx, dy=dy, curvePen=Qt.QPen(Qt.Qt.black, 2), curveSymbol=Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, Qt.QBrush(Qt.Qt.red), Qt.QPen(Qt.Qt.black, 2), Qt.QSize(9, 9)), errorPen=Qt.QPen(Qt.Qt.blue, 2), errorCap=10, errorOnTop=errorOnTop, ) curve.attach(demo) demo.resize(400, 300) demo.show() return demo
def create_plot(self): self.Trigger1 = 0 self.MaxSamplesPlot1 = 6000 plot = Qwt.QwtPlot(self) plot.setCanvasBackground(Qt.black) plot.setAxisTitle(Qwt.QwtPlot.xBottom, '') plot.setAxisScale(Qwt.QwtPlot.xBottom, 0, 20, 5) plot.setAxisTitle(Qwt.QwtPlot.yLeft, 'Heart Rhythm [Raw Value]') plot.setAxisAutoScale(Qwt.QwtPlot.yLeft) plot.replot() curve = [None] * 3 pen = [ QPen(QColor('limegreen')), QPen(QColor('red')), QPen(QColor('magenta')) ] for i in range(3): curve[i] = Qwt.QwtPlotCurve('') curve[i].setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) pen[i].setWidth(2) curve[i].setPen(pen[i]) curve[i].attach(plot) return plot, curve
def __init__(self, *args): Qt.QMainWindow.__init__(self, *args) self.plot = Qwt.QwtPlot(self) self.plot.setTitle("A Simple Map Demonstration") self.plot.setCanvasBackground(Qt.Qt.white) self.plot.setAxisTitle(Qwt.QwtPlot.xBottom, "x") self.plot.setAxisTitle(Qwt.QwtPlot.yLeft, "y") self.plot.setAxisScale(Qwt.QwtPlot.xBottom, 0.0, 1.0) self.plot.setAxisScale(Qwt.QwtPlot.yLeft, 0.0, 1.0) self.setCentralWidget(self.plot) # Initialize map data self.count = self.i = 1000 self.xs = zeros(self.count, Float) self.ys = zeros(self.count, Float) self.kappa = 0.2 self.curve = Qwt.QwtPlotCurve("Map") self.curve.attach(self.plot) self.curve.setSymbol( Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, Qt.QBrush(Qt.Qt.red), Qt.QPen(Qt.Qt.blue), Qt.QSize(5, 5))) self.curve.setPen(Qt.QPen(Qt.Qt.cyan)) toolBar = Qt.QToolBar(self) self.addToolBar(toolBar) toolBar.addWidget(Qt.QLabel("Count:", toolBar)) sizeCounter = Qwt.QwtCounter(toolBar) toolBar.addWidget(sizeCounter) toolBar.addSeparator() sizeCounter.setRange(0, 1000000, 100) sizeCounter.setValue(self.count) sizeCounter.setNumButtons(3) self.connect(sizeCounter, Qt.SIGNAL('valueChanged(double)'), self.setCount) toolBar.addWidget(Qt.QLabel("Ticks (ms):", toolBar)) tickCounter = Qwt.QwtCounter(toolBar) toolBar.addWidget(tickCounter) toolBar.addSeparator() # 1 tick = 1 ms, 10 ticks = 10 ms (Linux clock is 100 Hz) self.ticks = 10 tickCounter.setRange(0, 1000, 1) tickCounter.setValue(self.ticks) tickCounter.setNumButtons(3) self.connect(tickCounter, Qt.SIGNAL('valueChanged(double)'), self.setTicks) self.tid = self.startTimer(self.ticks) self.timer_tic = None self.user_tic = None self.system_tic = None self.plot.replot()
def make(): demo = Qwt.QwtPlot() picker = Qwt.QwtPlotPicker(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PointSelection, Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.AlwaysOn, demo.canvas()) picker.connect(picker, Qt.SIGNAL("selected(const QwtDoublePoint&)"), aSlot) return demo
def create_plot( self ): plot = Qwt.QwtPlot(self) plot.setCanvasBackground(Qt.black) plot.setAxisTitle(Qwt.QwtPlot.xBottom, 'Time') plot.enableAxis( Qwt.QwtPlot.yLeft, True ) zoomer = Qwt.QwtPlotMagnifier( plot.canvas() ) zoomer.setAxisEnabled(Qwt.QwtPlot.xBottom,False ) self.plot = plot return plot
def __init__(self, parent, **kwargs): #signals = [] pythics.libcontrol.Control.__init__(self, parent, **kwargs) self._widget = Qwt.QwtPlot() self._grid = Qwt.QwtPlotGrid() self._grid.enableX(False) self._grid.enableY(False) self._grid.attach(self._widget) self._elements = dict() p = self._widget g = self._grid if 'background' in kwargs: value = kwargs.pop('background') p.setCanvasBackground(QtGui.QColor(value)) else: # default white background color self._widget.setCanvasBackground(QtCore.Qt.white) if 'margin' in kwargs: value = kwargs.pop('margin') p.setMargin(value) if 'x_auto_scale' in kwargs: value = kwargs.pop('x_auto_scale') p.setAxisAutoScale(Qwt.QwtPlot.xBottom, value) if 'y_auto_scale' in kwargs: value = kwargs.pop('y_auto_scale') p.setAxisAutoScale(Qwt.QwtPlot.yLeft, value) if 'x_scale' in kwargs: value = kwargs.pop('x_scale') # NEED TO CONVERT VALUE TO THE APPROPRIATE TYPE!!!!!!!!!!!!!!!!! p.setAxisScale(Qwt.QwtPlot.xBottom, value) if 'y_scale' in kwargs: value = kwargs.pop('y_scale') # NEED TO CONVERT VALUE TO THE APPROPRIATE TYPE!!!!!!!!!!!!!!!!! p.setAxisScale(Qwt.QwtPlot.yLeft, value) if 'title' in kwargs: value = kwargs.pop('title') p.setTitle(value) if 'x_title' in kwargs: value = kwargs.pop('x_title') p.setAxisTitle(Qwt.QwtPlot.xBottom, value) if 'y_title' in kwargs: value = kwargs.pop('y_title') p.setAxisTitle(Qwt.QwtPlot.yLeft, value) if 'x_grid' in kwargs: value = kwargs.pop('x_grid') g.enableX(value) if 'y_grid' in kwargs: value = kwargs.pop('y_grid') g.enableY(value) if 'dashed_grid' in kwargs: if kwargs.pop('dashed_grid'): grid_line = QtGui.QPen(QtCore.Qt.DashLine) g.setPen(grid_line)
def setupUi(self, TabWidget, width, height, host_orch, host_pp): TabWidget.setObjectName(_fromUtf8("TabWidget")) #TabWidget.resize(600, 600) TabWidget.resize(width, height) self.tab_pp = QtGui.QWidget() self.tab_orch = QtGui.QWidget() self.plot_pp = Qwt.QwtPlot() self.plot_orch = Qwt.QwtPlot() self.plotter_pp = cpuplotter.CpuPlot(self.plot_pp) self.plotter_pp.sethost(host_pp) self.plotter_orch = cpuplotter.CpuPlot(self.plot_orch) self.plotter_orch.sethost(host_orch) self.tab_orch.setObjectName(_fromUtf8("tab_orch")) self.tab_pp.setObjectName(_fromUtf8("tab_pp")) self.scrollArea = QtGui.QScrollArea(self.tab_orch) self.scrollArea2 = QtGui.QScrollArea(self.tab_pp) #self.scrollArea.setGeometry(QtCore.QRect(10, 19, 501, 501)) self.scrollArea.setGeometry( QtCore.QRect(10, 19, width - 100, height - 10)) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName(_fromUtf8("scrollArea")) # self.scrollArea2.setGeometry(QtCore.QRect(10, 19, 521, 501)) self.scrollArea2.setGeometry( QtCore.QRect(10, 19, width - 100, height - 10)) self.scrollArea2.setWidgetResizable(True) self.scrollArea2.setObjectName(_fromUtf8("scrollArea")) self.scrollArea.setWidget(self.plotter_pp) self.scrollArea2.setWidget(self.plotter_orch) TabWidget.addTab(self.tab_pp, _fromUtf8("Orchestrator Workload")) TabWidget.addTab(self.tab_orch, _fromUtf8("Processor Workload")) TabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(TabWidget)
def initControls(self): self.plot3 = Qwt.QwtPlot(self) self.plot3.setCanvasBackground(Qt.white) self.plot3.enableAxis(Qwt.QwtPlot.yLeft, False) self.plot3.enableAxis(Qwt.QwtPlot.xBottom, False) self.plot1 = Qwt.QwtPlot(self) self.plot1.setCanvasBackground(Qt.white) SeacherButton = QPushButton("&Seacher") FrontButton = QPushButton("<<") LaterButton = QPushButton(">>") top_hbox = QHBoxLayout() top_hbox.addWidget(FrontButton) top_hbox.addWidget(SeacherButton) top_hbox.addWidget(LaterButton) below_hbox = QHBoxLayout() below_hbox.addWidget(self.plot1) below_hbox.addWidget(self.plot3) hbox = QVBoxLayout() hbox.addLayout(top_hbox, 2.5) hbox.addLayout(below_hbox, 1.5) self.setLayout(hbox)
def make(): demo = Qwt.QwtPlot() demo.setTitle('Masked Data Demo') demo.setCanvasBackground(Qt.Qt.white) # num = 501 causes a divide by zero warning 64-bit Gentoo x = np.linspace(-2 * np.pi, 2 * np.pi, num=501) y = 1 / np.sin(x) mask = np.logical_and(y > -3.0, y < 3.0) curve = MaskedCurve(x, y, mask) curve.attach(demo) demo.resize(500, 300) demo.show() return demo
def __init__(self, parent, xa, ya, minValue, maxValue, step, qwtPlot, colorCanvas, namePlot=u'', titleList=None): if not titleList: titleList = {} self.parent = parent self.qwtPlot = Qwt.QwtPlot( Qwt.QwtText('self.parent.scrollArea.viewport()')) if self.parent.countGraphic == 0: countGraphic = 1 else: countGraphic = self.parent.countGraphic namePlotQwtText = Qwt.QwtText(namePlot) font = QtGui.QFont() font.setWeight(8) font.setBold(False) namePlotQwtText.setFont(font) self.qwtPlot.setAutoReplot(True) self.qwtPlot.setTitle(namePlotQwtText) self.qwtPlot.setCanvasBackground(QtCore.Qt.white) megaGrid = Qwt.QwtPlotGrid() megaGrid.enableXMin(False) megaGrid.enableYMin(True) megaGrid.attach(self.qwtPlot) ca = Qwt.QwtPlotCurve() ca.setPen(QtGui.QPen(colorCanvas)) ca.setData(xa, ya) ca.attach(self.qwtPlot) self.qwtPlot.enableAxis(Qwt.QwtPlot.xTop, True) self.qwtPlot.setAxisScale(Qwt.QwtPlot.yLeft, minValue, maxValue, step) axisLen = len(xa) + 1 self.qwtPlot.setAxisScale(Qwt.QwtPlot.xBottom, 0, axisLen, 1.0) self.qwtPlot.setAxisScale(Qwt.QwtPlot.xTop, 0, axisLen, 1.0) axisScaleDraw = self.qwtPlot.axisScaleDraw(Qwt.QwtPlot.xBottom) self.qwtPlot.setAxisScaleDraw( Qwt.QwtPlot.xBottom, CMyQwtScaleDrawXBottom(axisScaleDraw, titleList)) axisScaleDraw = self.qwtPlot.axisScaleDraw(Qwt.QwtPlot.xTop) self.qwtPlot.setAxisScaleDraw( Qwt.QwtPlot.xTop, CMyQwtScaleDrawXTop(axisScaleDraw, titleList))
def __init__(self): QtGui.QMainWindow.__init__(self) ''' self.view = pg.GraphicsView() self.graph = pg.PlotItem() self.view.setCentralWidget(self.graph) self.setCentralWidget(self.view) testx = np.random.rand(10) testy = np.random.rand(10) self.graph.plot(testx,testy,pen=None,symbol='o') ''' self.qwtPlot = Qwt5.QwtPlot(self) self.setCentralWidget(self.qwtPlot) #self.qwtPlot.setGeometry(QtCore.QRect(260, 400, 581, 200)) self.scatter = Qwt5.QwtPlotCurve('') self.scatter.attach(self.qwtPlot) self.scatter.setPen(QtGui.QPen(QtCore.Qt.NoPen)) scatter_symbol = Qwt5.QwtSymbol(Qwt5.QwtSymbol.Ellipse, QtGui.QBrush(QtCore.Qt.red), QtGui.QPen(QtCore.Qt.red), QtCore.QSize(7, 7)) self.scatter.setSymbol(scatter_symbol) self.scatterAll = Qwt5.QwtPlotCurve('') self.scatterAll.attach(self.qwtPlot) self.scatterAll.setPen(QtGui.QPen(QtCore.Qt.NoPen)) scatter_symbol = Qwt5.QwtSymbol(Qwt5.QwtSymbol.Ellipse, QtGui.QBrush(QtCore.Qt.black), QtGui.QPen(QtCore.Qt.black), QtCore.QSize(3, 3)) self.scatterAll.setSymbol(scatter_symbol) self.setGeometry(40, 40, 512, 512) self.cell_size = 32 self.threshold = 200 self.fof = fof.MedFastObjectFinder(self.cell_size, self.threshold) #self.setLayout(vbox) self.statusBar = QtGui.QStatusBar(self) self.setStatusBar(self.statusBar) self.allXs = np.array([]) self.allYs = np.array([])
def create_plot2(self): plot2 = Qwt.QwtPlot(self) plot2.setCanvasBackground(Qt.black) plot2.setAxisTitle(Qwt.QwtPlot.xBottom, 'Time') plot2.setAxisScale(Qwt.QwtPlot.xBottom, 0, 10, 1) plot2.setAxisTitle(Qwt.QwtPlot.yLeft, 'Altitude (m)') plot2.setAxisScale(Qwt.QwtPlot.yLeft, 400, 3500, 250) plot2.replot() curve2 = Qwt.QwtPlotCurve('') curve2.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) pen2 = QPen(QColor('limegreen')) pen2.setWidth(2) curve2.setPen(pen2) curve2.attach(plot2) return plot2, curve2
def create_plot(self): plot = Qwt.QwtPlot(self) plot.setCanvasBackground(Qt.black) plot.setAxisTitle(Qwt.QwtPlot.xBottom, 'Time') plot.setAxisScale(Qwt.QwtPlot.xBottom, 0, 10, 1) plot.setAxisTitle(Qwt.QwtPlot.yLeft, 'Temperature') plot.setAxisScale(Qwt.QwtPlot.yLeft, -60, 60, 10) plot.replot() curve = Qwt.QwtPlotCurve('') curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased) pen = QPen(QColor('limegreen')) pen.setWidth(2) curve.setPen(pen) curve.attach(plot) return plot, curve
def setupUi(self, win_plot): win_plot.setObjectName(_fromUtf8("win_plot")) win_plot.resize(800, 600) self.centralwidget = QtGui.QWidget(win_plot) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.qwtPlot = Qwt5.QwtPlot(self.centralwidget) self.qwtPlot.setEnabled(False) self.qwtPlot.setObjectName(_fromUtf8("qwtPlot")) self.verticalLayout.addWidget(self.qwtPlot) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setContentsMargins(6, 0, 6, 0) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.btn_gesture_0 = QtGui.QPushButton(self.centralwidget) self.btn_gesture_0.setEnabled(True) self.btn_gesture_0.setCheckable(False) self.btn_gesture_0.setAutoRepeat(False) self.btn_gesture_0.setObjectName(_fromUtf8("btn_gesture_0")) self.horizontalLayout.addWidget(self.btn_gesture_0) self.btn_gesture_1 = QtGui.QPushButton(self.centralwidget) self.btn_gesture_1.setObjectName(_fromUtf8("btn_gesture_1")) self.horizontalLayout.addWidget(self.btn_gesture_1) self.btn_gesture_2 = QtGui.QPushButton(self.centralwidget) self.btn_gesture_2.setObjectName(_fromUtf8("btn_gesture_2")) self.horizontalLayout.addWidget(self.btn_gesture_2) self.btn_gesture_3 = QtGui.QPushButton(self.centralwidget) self.btn_gesture_3.setObjectName(_fromUtf8("btn_gesture_3")) self.horizontalLayout.addWidget(self.btn_gesture_3) self.btn_gesture_4 = QtGui.QPushButton(self.centralwidget) self.btn_gesture_4.setObjectName(_fromUtf8("btn_gesture_4")) self.horizontalLayout.addWidget(self.btn_gesture_4) self.btn_gesture_5 = QtGui.QPushButton(self.centralwidget) self.btn_gesture_5.setObjectName(_fromUtf8("btn_gesture_5")) self.horizontalLayout.addWidget(self.btn_gesture_5) self.btn_gesture_6 = QtGui.QPushButton(self.centralwidget) self.btn_gesture_6.setObjectName(_fromUtf8("btn_gesture_6")) self.horizontalLayout.addWidget(self.btn_gesture_6) self.btn_gesture_7 = QtGui.QPushButton(self.centralwidget) self.btn_gesture_7.setObjectName(_fromUtf8("btn_gesture_7")) self.horizontalLayout.addWidget(self.btn_gesture_7) self.verticalLayout.addLayout(self.horizontalLayout) win_plot.setCentralWidget(self.centralwidget) self.retranslateUi(win_plot) QtCore.QMetaObject.connectSlotsByName(win_plot)
def make(): demo = Qwt.QwtPlot() demo.setTitle('Symbols Demo') curve = QwtPlotCurveSizes() curve.attach(demo) curve_a = QwtPlotCurveSizes() curve_a.attach(demo) # need to create a default symbol for the curves due to inner # workings of QwtCurve curve.setSymbol( Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, Qt.QBrush(Qt.Qt.black), Qt.QPen(Qt.Qt.black), Qt.QSize(5, 5))) curve.setPen(Qt.QPen(Qt.Qt.blue, 2)) curve_a.setSymbol( Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, Qt.QBrush(Qt.Qt.black), Qt.QPen(Qt.Qt.black), Qt.QSize(5, 5))) curve_a.setPen(Qt.QPen(Qt.Qt.blue, 2)) # create some data x_array = numpy.zeros(20, numpy.float32) y_array = numpy.zeros(20, numpy.float32) symbol_sizes = numpy.zeros(20, numpy.int32) symbolList = [] for i in range(20): x_array[i] = 1.0 * i y_array[i] = 2.0 * i symbol_sizes[i] = 3 + i if i % 2 == 0: symbolList.append( Qwt.QwtSymbol(Qwt.QwtSymbol.UTriangle, Qt.QBrush(Qt.Qt.black), Qt.QPen(Qt.Qt.black), Qt.QSize(3 + i, 3 + i))) else: symbolList.append( Qwt.QwtSymbol(Qwt.QwtSymbol.DTriangle, Qt.QBrush(Qt.Qt.red), Qt.QPen(Qt.Qt.red), Qt.QSize(3 + i, 3 + i))) curve.setData(x_array, y_array, symbol_sizes) x_array = x_array + 10 curve_a.setData(x_array, y_array) curve_a.setSymbolList(symbolList) grid = Qwt.QwtPlotGrid() grid.setMajPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine)) grid.setMinPen(Qt.QPen(Qt.Qt.gray, 0, Qt.Qt.DotLine)) grid.attach(demo) demo.replot() return demo