def setupUi(self, Form): Form.setObjectName("Form") Form.resize(1164, 638) self.pop_graph = MultiPlotWidget(Form) self.pop_graph.setGeometry(QtCore.QRect(40, 40, 1101, 561)) self.pop_graph.setObjectName("pop_graph") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(1164, 638) self.pop_graph = MultiPlotWidget(Form) self.pop_graph.setGeometry(QtCore.QRect(40, 40, 1101, 561)) self.pop_graph.setObjectName("pop_graph") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form"))
from scipy import random from numpy import linspace from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg from pyqtgraph import MultiPlotWidget try: from pyqtgraph.metaarray import * except: print("MultiPlot is only used with MetaArray for now (and you do not have the metaarray package)") exit() app = QtGui.QApplication([]) mw = QtGui.QMainWindow() mw.resize(800,800) pw = MultiPlotWidget() mw.setCentralWidget(pw) mw.show() data = random.normal(size=(3, 1000)) * np.array([[0.1], [1e-5], [1]]) ma = MetaArray(data, info=[ {'name': 'Signal', 'cols': [ {'name': 'Col1', 'units': 'V'}, {'name': 'Col2', 'units': 'A'}, {'name': 'Col3'}, ]}, {'name': 'Time', 'values': linspace(0., 1., 1000), 'units': 's'} ]) pw.plot(ma) ## Start Qt event loop unless running in interactive mode.
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1234, 911) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.layoutWidget = QtWidgets.QWidget(self.centralwidget) self.layoutWidget.setGeometry(QtCore.QRect(20, 480, 1211, 357)) self.layoutWidget.setObjectName("layoutWidget") self.horizontalLayout_14 = QtWidgets.QHBoxLayout(self.layoutWidget) self.horizontalLayout_14.setSizeConstraint( QtWidgets.QLayout.SetDefaultConstraint) self.horizontalLayout_14.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_14.setObjectName("horizontalLayout_14") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.gains_l = QtWidgets.QLabel(self.layoutWidget) self.gains_l.setMaximumSize(QtCore.QSize(102, 100)) self.gains_l.setObjectName("gains_l") self.horizontalLayout_2.addWidget(self.gains_l) self.gain1 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain1.sizePolicy().hasHeightForWidth()) self.gain1.setSizePolicy(sizePolicy) self.gain1.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain1.setFont(font) self.gain1.setObjectName("gain1") self.horizontalLayout_2.addWidget(self.gain1) self.verticalLayout.addLayout(self.horizontalLayout_2) spacerItem = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout.addItem(spacerItem) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout_11 = QtWidgets.QVBoxLayout() self.verticalLayout_11.setObjectName("verticalLayout_11") self.max_gain_l = QtWidgets.QLabel(self.layoutWidget) font = QtGui.QFont() font.setPointSize(10) self.max_gain_l.setFont(font) self.max_gain_l.setObjectName("max_gain_l") self.verticalLayout_11.addWidget(self.max_gain_l) spacerItem1 = QtWidgets.QSpacerItem(20, 80, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_11.addItem(spacerItem1) self.max_gain_2 = QtWidgets.QLabel(self.layoutWidget) font = QtGui.QFont() font.setPointSize(10) self.max_gain_2.setFont(font) self.max_gain_2.setObjectName("max_gain_2") self.verticalLayout_11.addWidget(self.max_gain_2) spacerItem2 = QtWidgets.QSpacerItem(20, 80, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_11.addItem(spacerItem2) self.min_gain_l = QtWidgets.QLabel(self.layoutWidget) font = QtGui.QFont() font.setPointSize(10) self.min_gain_l.setFont(font) self.min_gain_l.setObjectName("min_gain_l") self.verticalLayout_11.addWidget(self.min_gain_l) self.horizontalLayout.addLayout(self.verticalLayout_11) spacerItem3 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem3) self.slider1 = QtWidgets.QSlider(self.layoutWidget) self.slider1.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider1.sizePolicy().hasHeightForWidth()) self.slider1.setSizePolicy(sizePolicy) self.slider1.setOrientation(QtCore.Qt.Vertical) self.slider1.setObjectName("slider1") self.horizontalLayout.addWidget(self.slider1) spacerItem4 = QtWidgets.QSpacerItem(18, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem4) self.verticalLayout.addLayout(self.horizontalLayout) spacerItem5 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout.addItem(spacerItem5) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.freq_l = QtWidgets.QLabel(self.layoutWidget) self.freq_l.setMaximumSize(QtCore.QSize(102, 100)) self.freq_l.setObjectName("freq_l") self.horizontalLayout_3.addWidget(self.freq_l) self.freq1 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq1.sizePolicy().hasHeightForWidth()) self.freq1.setSizePolicy(sizePolicy) self.freq1.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq1.setFont(font) self.freq1.setObjectName("freq1") self.horizontalLayout_3.addWidget(self.freq1) self.verticalLayout.addLayout(self.horizontalLayout_3) self.horizontalLayout_14.addLayout(self.verticalLayout) spacerItem6 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem6) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.gain2 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain2.sizePolicy().hasHeightForWidth()) self.gain2.setSizePolicy(sizePolicy) self.gain2.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain2.setFont(font) self.gain2.setObjectName("gain2") self.verticalLayout_2.addWidget(self.gain2) spacerItem7 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_2.addItem(spacerItem7) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") spacerItem8 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem8) self.slider2 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider2.sizePolicy().hasHeightForWidth()) self.slider2.setSizePolicy(sizePolicy) self.slider2.setOrientation(QtCore.Qt.Vertical) self.slider2.setObjectName("slider2") self.horizontalLayout_5.addWidget(self.slider2) spacerItem9 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem9) self.verticalLayout_2.addLayout(self.horizontalLayout_5) spacerItem10 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_2.addItem(spacerItem10) self.freq2 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq2.sizePolicy().hasHeightForWidth()) self.freq2.setSizePolicy(sizePolicy) self.freq2.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq2.setFont(font) self.freq2.setObjectName("freq2") self.verticalLayout_2.addWidget(self.freq2) self.horizontalLayout_14.addLayout(self.verticalLayout_2) spacerItem11 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem11) self.verticalLayout_13 = QtWidgets.QVBoxLayout() self.verticalLayout_13.setObjectName("verticalLayout_13") self.gain3 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain3.sizePolicy().hasHeightForWidth()) self.gain3.setSizePolicy(sizePolicy) self.gain3.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain3.setFont(font) self.gain3.setObjectName("gain3") self.verticalLayout_13.addWidget(self.gain3) spacerItem12 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_13.addItem(spacerItem12) self.horizontalLayout_15 = QtWidgets.QHBoxLayout() self.horizontalLayout_15.setObjectName("horizontalLayout_15") spacerItem13 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_15.addItem(spacerItem13) self.slider3 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider3.sizePolicy().hasHeightForWidth()) self.slider3.setSizePolicy(sizePolicy) self.slider3.setOrientation(QtCore.Qt.Vertical) self.slider3.setObjectName("slider3") self.horizontalLayout_15.addWidget(self.slider3) spacerItem14 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_15.addItem(spacerItem14) self.verticalLayout_13.addLayout(self.horizontalLayout_15) spacerItem15 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_13.addItem(spacerItem15) self.freq3 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq3.sizePolicy().hasHeightForWidth()) self.freq3.setSizePolicy(sizePolicy) self.freq3.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq3.setFont(font) self.freq3.setObjectName("freq3") self.verticalLayout_13.addWidget(self.freq3) self.horizontalLayout_14.addLayout(self.verticalLayout_13) spacerItem16 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem16) self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setObjectName("verticalLayout_4") self.gain4 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain4.sizePolicy().hasHeightForWidth()) self.gain4.setSizePolicy(sizePolicy) self.gain4.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain4.setFont(font) self.gain4.setObjectName("gain4") self.verticalLayout_4.addWidget(self.gain4) spacerItem17 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_4.addItem(spacerItem17) self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") spacerItem18 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem18) self.slider4 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider4.sizePolicy().hasHeightForWidth()) self.slider4.setSizePolicy(sizePolicy) self.slider4.setOrientation(QtCore.Qt.Vertical) self.slider4.setObjectName("slider4") self.horizontalLayout_7.addWidget(self.slider4) spacerItem19 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem19) self.verticalLayout_4.addLayout(self.horizontalLayout_7) spacerItem20 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_4.addItem(spacerItem20) self.freq4 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq4.sizePolicy().hasHeightForWidth()) self.freq4.setSizePolicy(sizePolicy) self.freq4.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq4.setFont(font) self.freq4.setObjectName("freq4") self.verticalLayout_4.addWidget(self.freq4) self.horizontalLayout_14.addLayout(self.verticalLayout_4) spacerItem21 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem21) self.verticalLayout_5 = QtWidgets.QVBoxLayout() self.verticalLayout_5.setObjectName("verticalLayout_5") self.gain5 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain5.sizePolicy().hasHeightForWidth()) self.gain5.setSizePolicy(sizePolicy) self.gain5.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain5.setFont(font) self.gain5.setObjectName("gain5") self.verticalLayout_5.addWidget(self.gain5) spacerItem22 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_5.addItem(spacerItem22) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") spacerItem23 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem23) self.slider5 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider5.sizePolicy().hasHeightForWidth()) self.slider5.setSizePolicy(sizePolicy) self.slider5.setOrientation(QtCore.Qt.Vertical) self.slider5.setObjectName("slider5") self.horizontalLayout_8.addWidget(self.slider5) spacerItem24 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem24) self.verticalLayout_5.addLayout(self.horizontalLayout_8) spacerItem25 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_5.addItem(spacerItem25) self.freq5 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq5.sizePolicy().hasHeightForWidth()) self.freq5.setSizePolicy(sizePolicy) self.freq5.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq5.setFont(font) self.freq5.setObjectName("freq5") self.verticalLayout_5.addWidget(self.freq5) self.horizontalLayout_14.addLayout(self.verticalLayout_5) spacerItem26 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem26) self.verticalLayout_6 = QtWidgets.QVBoxLayout() self.verticalLayout_6.setObjectName("verticalLayout_6") self.gain6 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain6.sizePolicy().hasHeightForWidth()) self.gain6.setSizePolicy(sizePolicy) self.gain6.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain6.setFont(font) self.gain6.setObjectName("gain6") self.verticalLayout_6.addWidget(self.gain6) spacerItem27 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_6.addItem(spacerItem27) self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") spacerItem28 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem28) self.slider6 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider6.sizePolicy().hasHeightForWidth()) self.slider6.setSizePolicy(sizePolicy) self.slider6.setOrientation(QtCore.Qt.Vertical) self.slider6.setObjectName("slider6") self.horizontalLayout_9.addWidget(self.slider6) spacerItem29 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem29) self.verticalLayout_6.addLayout(self.horizontalLayout_9) spacerItem30 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_6.addItem(spacerItem30) self.freq6 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq6.sizePolicy().hasHeightForWidth()) self.freq6.setSizePolicy(sizePolicy) self.freq6.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq6.setFont(font) self.freq6.setObjectName("freq6") self.verticalLayout_6.addWidget(self.freq6) self.horizontalLayout_14.addLayout(self.verticalLayout_6) spacerItem31 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem31) self.verticalLayout_7 = QtWidgets.QVBoxLayout() self.verticalLayout_7.setObjectName("verticalLayout_7") self.gain7 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain7.sizePolicy().hasHeightForWidth()) self.gain7.setSizePolicy(sizePolicy) self.gain7.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain7.setFont(font) self.gain7.setObjectName("gain7") self.verticalLayout_7.addWidget(self.gain7) spacerItem32 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_7.addItem(spacerItem32) self.horizontalLayout_10 = QtWidgets.QHBoxLayout() self.horizontalLayout_10.setObjectName("horizontalLayout_10") spacerItem33 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem33) self.slider7 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider7.sizePolicy().hasHeightForWidth()) self.slider7.setSizePolicy(sizePolicy) self.slider7.setOrientation(QtCore.Qt.Vertical) self.slider7.setObjectName("slider7") self.horizontalLayout_10.addWidget(self.slider7) spacerItem34 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_10.addItem(spacerItem34) self.verticalLayout_7.addLayout(self.horizontalLayout_10) spacerItem35 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_7.addItem(spacerItem35) self.freq7 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq7.sizePolicy().hasHeightForWidth()) self.freq7.setSizePolicy(sizePolicy) self.freq7.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq7.setFont(font) self.freq7.setObjectName("freq7") self.verticalLayout_7.addWidget(self.freq7) self.horizontalLayout_14.addLayout(self.verticalLayout_7) spacerItem36 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem36) self.verticalLayout_8 = QtWidgets.QVBoxLayout() self.verticalLayout_8.setObjectName("verticalLayout_8") self.gain8 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain8.sizePolicy().hasHeightForWidth()) self.gain8.setSizePolicy(sizePolicy) self.gain8.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain8.setFont(font) self.gain8.setObjectName("gain8") self.verticalLayout_8.addWidget(self.gain8) spacerItem37 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_8.addItem(spacerItem37) self.horizontalLayout_11 = QtWidgets.QHBoxLayout() self.horizontalLayout_11.setObjectName("horizontalLayout_11") spacerItem38 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_11.addItem(spacerItem38) self.slider8 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider8.sizePolicy().hasHeightForWidth()) self.slider8.setSizePolicy(sizePolicy) self.slider8.setOrientation(QtCore.Qt.Vertical) self.slider8.setObjectName("slider8") self.horizontalLayout_11.addWidget(self.slider8) spacerItem39 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_11.addItem(spacerItem39) self.verticalLayout_8.addLayout(self.horizontalLayout_11) spacerItem40 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_8.addItem(spacerItem40) self.freq8 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq8.sizePolicy().hasHeightForWidth()) self.freq8.setSizePolicy(sizePolicy) self.freq8.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq8.setFont(font) self.freq8.setObjectName("freq8") self.verticalLayout_8.addWidget(self.freq8) self.horizontalLayout_14.addLayout(self.verticalLayout_8) spacerItem41 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem41) self.verticalLayout_9 = QtWidgets.QVBoxLayout() self.verticalLayout_9.setObjectName("verticalLayout_9") self.gain9 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain9.sizePolicy().hasHeightForWidth()) self.gain9.setSizePolicy(sizePolicy) self.gain9.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain9.setFont(font) self.gain9.setObjectName("gain9") self.verticalLayout_9.addWidget(self.gain9) spacerItem42 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_9.addItem(spacerItem42) self.horizontalLayout_12 = QtWidgets.QHBoxLayout() self.horizontalLayout_12.setObjectName("horizontalLayout_12") spacerItem43 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem43) self.slider9 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider9.sizePolicy().hasHeightForWidth()) self.slider9.setSizePolicy(sizePolicy) self.slider9.setOrientation(QtCore.Qt.Vertical) self.slider9.setObjectName("slider9") self.horizontalLayout_12.addWidget(self.slider9) spacerItem44 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem44) self.verticalLayout_9.addLayout(self.horizontalLayout_12) spacerItem45 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_9.addItem(spacerItem45) self.freq9 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq9.sizePolicy().hasHeightForWidth()) self.freq9.setSizePolicy(sizePolicy) self.freq9.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq9.setFont(font) self.freq9.setObjectName("freq9") self.verticalLayout_9.addWidget(self.freq9) self.horizontalLayout_14.addLayout(self.verticalLayout_9) spacerItem46 = QtWidgets.QSpacerItem(18, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_14.addItem(spacerItem46) self.verticalLayout_10 = QtWidgets.QVBoxLayout() self.verticalLayout_10.setObjectName("verticalLayout_10") self.gain10 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.gain10.sizePolicy().hasHeightForWidth()) self.gain10.setSizePolicy(sizePolicy) self.gain10.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.gain10.setFont(font) self.gain10.setObjectName("gain10") self.verticalLayout_10.addWidget(self.gain10) spacerItem47 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_10.addItem(spacerItem47) self.horizontalLayout_13 = QtWidgets.QHBoxLayout() self.horizontalLayout_13.setObjectName("horizontalLayout_13") spacerItem48 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem48) self.slider10 = QtWidgets.QSlider(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.slider10.sizePolicy().hasHeightForWidth()) self.slider10.setSizePolicy(sizePolicy) self.slider10.setOrientation(QtCore.Qt.Vertical) self.slider10.setObjectName("slider10") self.horizontalLayout_13.addWidget(self.slider10) spacerItem49 = QtWidgets.QSpacerItem(15, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem49) self.verticalLayout_10.addLayout(self.horizontalLayout_13) spacerItem50 = QtWidgets.QSpacerItem(18, 8, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_10.addItem(spacerItem50) self.freq10 = QtWidgets.QTextBrowser(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.freq10.sizePolicy().hasHeightForWidth()) self.freq10.setSizePolicy(sizePolicy) self.freq10.setMaximumSize(QtCore.QSize(70, 25)) font = QtGui.QFont() font.setPointSize(9) self.freq10.setFont(font) self.freq10.setObjectName("freq10") self.verticalLayout_10.addWidget(self.freq10) self.horizontalLayout_14.addLayout(self.verticalLayout_10) self.layoutWidget1 = QtWidgets.QWidget(self.centralwidget) self.layoutWidget1.setGeometry(QtCore.QRect(9, 9, 1216, 461)) self.layoutWidget1.setObjectName("layoutWidget1") self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.layoutWidget1) self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.verticalLayout_12 = QtWidgets.QVBoxLayout() self.verticalLayout_12.setObjectName("verticalLayout_12") self.add_file_btn = QtWidgets.QPushButton(self.layoutWidget1) self.add_file_btn.setObjectName("add_file_btn") self.verticalLayout_12.addWidget(self.add_file_btn) spacerItem51 = QtWidgets.QSpacerItem(20, 100, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_12.addItem(spacerItem51) self.test1 = QtWidgets.QRadioButton(self.layoutWidget1) font = QtGui.QFont() font.setFamily("Sans") font.setPointSize(9) font.setBold(True) font.setWeight(75) self.test1.setFont(font) self.test1.setObjectName("test1") self.verticalLayout_12.addWidget(self.test1) spacerItem52 = QtWidgets.QSpacerItem(18, 80, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_12.addItem(spacerItem52) self.test2 = QtWidgets.QRadioButton(self.layoutWidget1) font = QtGui.QFont() font.setFamily("Sans") font.setPointSize(9) font.setBold(True) font.setWeight(75) self.test2.setFont(font) self.test2.setObjectName("test2") self.verticalLayout_12.addWidget(self.test2) spacerItem53 = QtWidgets.QSpacerItem(18, 80, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_12.addItem(spacerItem53) self.pushButton = QtWidgets.QPushButton(self.layoutWidget1) self.pushButton.setObjectName("pushButton") self.verticalLayout_12.addWidget(self.pushButton) spacerItem54 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_12.addItem(spacerItem54) self.show_dif_btn = QtWidgets.QPushButton(self.layoutWidget1) font = QtGui.QFont() font.setPointSize(9) self.show_dif_btn.setFont(font) self.show_dif_btn.setObjectName("show_dif_btn") self.verticalLayout_12.addWidget(self.show_dif_btn) self.horizontalLayout_4.addLayout(self.verticalLayout_12) self.gView = MultiPlotWidget(self.layoutWidget1) self.gView.setObjectName("gView") self.horizontalLayout_4.addWidget(self.gView) self.save_btn = QtWidgets.QPushButton(self.centralwidget) self.save_btn.setGeometry(QtCore.QRect(1120, 750, 91, 25)) self.save_btn.setObjectName("save_btn") self.layoutWidget2 = QtWidgets.QWidget(self.centralwidget) self.layoutWidget2.setGeometry(QtCore.QRect(9, 786, 1216, 89)) self.layoutWidget2.setObjectName("layoutWidget2") self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.layoutWidget2) self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.play_btn = QtWidgets.QPushButton(self.layoutWidget2) self.play_btn.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.play_btn.setIcon(icon) self.play_btn.setIconSize(QtCore.QSize(30, 30)) self.play_btn.setObjectName("play_btn") self.horizontalLayout_6.addWidget(self.play_btn) self.pause_btn = QtWidgets.QPushButton(self.layoutWidget2) self.pause_btn.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap("pause.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pause_btn.setIcon(icon1) self.pause_btn.setIconSize(QtCore.QSize(30, 30)) self.pause_btn.setObjectName("pause_btn") self.horizontalLayout_6.addWidget(self.pause_btn) spacerItem55 = QtWidgets.QSpacerItem(10, 13, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_6.addItem(spacerItem55) self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.orgin_radio = QtWidgets.QRadioButton(self.layoutWidget2) font = QtGui.QFont() font.setPointSize(8) self.orgin_radio.setFont(font) self.orgin_radio.setObjectName("orgin_radio") self.verticalLayout_3.addWidget(self.orgin_radio) self.test_radio = QtWidgets.QRadioButton(self.layoutWidget2) font = QtGui.QFont() font.setPointSize(8) self.test_radio.setFont(font) self.test_radio.setObjectName("test_radio") self.verticalLayout_3.addWidget(self.test_radio) self.horizontalLayout_6.addLayout(self.verticalLayout_3) self.playGraph = PlotWidget(self.layoutWidget2) self.playGraph.setObjectName("playGraph") self.horizontalLayout_6.addWidget(self.playGraph) self.reset_btn = QtWidgets.QPushButton(self.centralwidget) self.reset_btn.setGeometry(QtCore.QRect(1010, 750, 91, 25)) self.reset_btn.setObjectName("reset_btn") self.window_comb = QtWidgets.QComboBox(self.centralwidget) self.window_comb.setGeometry(QtCore.QRect(830, 750, 157, 25)) self.window_comb.setObjectName("window_comb") self.window_comb.addItem("") self.window_comb.addItem("") self.window_comb.addItem("") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1234, 26)) self.menubar.setObjectName("menubar") self.menu_File = QtWidgets.QMenu(self.menubar) self.menu_File.setObjectName("menu_File") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionNew_Window = QtWidgets.QAction(MainWindow) self.actionNew_Window.setObjectName("actionNew_Window") self.menu_File.addAction(self.actionNew_Window) self.menubar.addAction(self.menu_File.menuAction()) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
import numpy as np from numpy import linspace from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg from pyqtgraph import MultiPlotWidget try: from pyqtgraph.metaarray import * except: print("MultiPlot is only used with MetaArray for now (and you do not have the metaarray package)") exit() app = QtGui.QApplication([]) mw = QtGui.QMainWindow() mw.resize(800,800) pw = MultiPlotWidget() mw.setCentralWidget(pw) mw.show() data = np.random.normal(size=(3, 1000)) * np.array([[0.1], [1e-5], [1]]) ma = MetaArray(data, info=[ {'name': 'Signal', 'cols': [ {'name': 'Col1', 'units': 'V'}, {'name': 'Col2', 'units': 'A'}, {'name': 'Col3'}, ]}, {'name': 'Time', 'values': linspace(0., 1., 1000), 'units': 's'} ]) pw.plot(ma, pen='y') ## Start Qt event loop unless running in interactive mode.
import initExample from scipy import random from numpy import linspace from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg from pyqtgraph import MultiPlotWidget try: from metaarray import * except: print("MultiPlot is only used with MetaArray for now (and you do not have the metaarray package)") exit() app = QtGui.QApplication([]) mw = QtGui.QMainWindow() mw.resize(800,800) pw = MultiPlotWidget() mw.setCentralWidget(pw) mw.show() ma = MetaArray(random.random((3, 1000)), info=[{'name': 'Signal', 'cols': [{'name': 'Col1'}, {'name': 'Col2'}, {'name': 'Col3'}]}, {'name': 'Time', 'vals': linspace(0., 1., 1000)}]) pw.plot(ma) ## Start Qt event loop unless running in interactive mode. if __name__ == '__main__': import sys if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'): QtGui.QApplication.instance().exec_()