本文整理汇总了Python中pyqtgraph.PlotWidget.setXLink方法的典型用法代码示例。如果您正苦于以下问题:Python PlotWidget.setXLink方法的具体用法?Python PlotWidget.setXLink怎么用?Python PlotWidget.setXLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.PlotWidget
的用法示例。
在下文中一共展示了PlotWidget.setXLink方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tiare
# 需要导入模块: from pyqtgraph import PlotWidget [as 别名]
# 或者: from pyqtgraph.PlotWidget import setXLink [as 别名]
class Tiare(QtGui.QMainWindow):
def __init__(self, *args):
QtGui.QMainWindow.__init__(self, *args)
self.statusBar().showMessage('Pret')
self.th = 0
self.widget = QtGui.QWidget(self)
exitAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&Quitter', self)
exitAction.setShortcut('Ctrl+Q')
exitAction.setStatusTip("Ferme l'application")
exitAction.triggered.connect(self.close)
openAction = QtGui.QAction(QtGui.QIcon('open.png'), '&Charger', self)
openAction.setShortcut('Ctrl+L')
openAction.setStatusTip("Charge un fichier wav")
openAction.triggered.connect(self.load)
self.saveAction = QtGui.QAction(QtGui.QIcon('save.png'), '&Exporter', self)
self.saveAction.setShortcut('Ctrl+S')
self.saveAction.setStatusTip("Exporter en CSV")
self.saveAction.triggered.connect(self.export)
self.saveAction.setEnabled(False)
menubar = self.menuBar()
fileMenu = menubar.addMenu('&Fichier')
fileMenu.addAction(openAction)
fileMenu.addAction(self.saveAction)
fileMenu.addAction(exitAction)
self.th_slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
self.th_slider.setValue(self.th)
self.th_slider.valueChanged[int].connect(self.change_threshold)
self.min_len = QtGui.QSlider(QtCore.Qt.Horizontal, self)
self.min_len.setValue(10)
self.min_len.setMinimum(1)
self.min_len.setMaximum(100)
self.min_len.valueChanged[int].connect(self.change_min_len)
self.min_len_sil = QtGui.QSlider(QtCore.Qt.Horizontal, self)
self.min_len_sil.setValue(10)
self.min_len_sil.setMinimum(1)
self.min_len_sil.setMaximum(100)
self.min_len_sil.valueChanged[int].connect(self.change_min_len)
# Make sizer and embed stuff
self.sizer = QtGui.QVBoxLayout(self.widget)
self.fig_signal = PlotWidget(self.widget, background="w")
self.fig_signal.setLimits(xMin=0, yMin=-1, yMax=1, minXRange=1, maxXRange=30, minYRange=2, maxYRange=2)
self.fig_energy = PlotWidget(self.widget, background="w")
self.fig_energy.setXLink(self.fig_signal)
self.fig_segments = PlotWidget(self.widget, background="w")
self.fig_segments.setXLink(self.fig_signal)
self.fig_segments.hideAxis('bottom')
self.fig_segments.hideAxis('left')
self.fig_segments.setLimits(yMin=-1, yMax=1, minYRange=2, maxYRange=2)
self.sizer.addWidget(self.fig_signal, 5)
self.sizer.addWidget(self.fig_energy, 5)
self.sizer.addWidget(self.fig_segments, 3)
self.sizer.addWidget(QtGui.QLabel('Seuil de segmentation'), 0)
self.sizer.addWidget(self.th_slider, 0)
self.min_seg_label = QtGui.QLabel('Longeur minimal de segment (%.3f s)' % (float(self.min_len.value())/100))
self.sizer.addWidget(self.min_seg_label, 0)
self.sizer.addWidget(self.min_len, 0)
self.min_sil_label = QtGui.QLabel('Longeur minimal de silence (%.3f s)' % (float(self.min_len_sil.value())/100))
self.sizer.addWidget(self.min_sil_label, 0)
self.sizer.addWidget(self.min_len_sil, 0)
# Apply sizers
self.setCentralWidget(self.widget)
# Finish
self.resize(560, 420)
self.setWindowTitle('Tiare')
self.energy_tl, self.energy = [], []
self.thline = None
self.seg_up = None
self.seg_down = None
self.fig_energy_plot = None
self.segments = []
self.samples = []
self.sr = 0
self.filepath = None
self.widget.hide()
self.show()
def change_threshold(self, value):
value = float(value)/100
if self.thline is not None :
self.thline.setData([self.energy_tl[0], self.energy_tl[-1]], [value]*2)
self.segments = map(lambda (x, y): (self.energy_tl[x],self.energy_tl[y]),
cut(self.energy, value, self.min_len.value(), self.min_len_sil.value()))
x = [v for start, stop in self.segments for v in [start, start, stop, stop]]
y = [v for _ in self.segments for v in [-0.85, 0.85, 0.85, -0.85]]
self.seg_up.setData(x, y)
self.seg_down.setData([self.energy_tl[0], self.energy_tl[-1]], [-0.85, -0.85])
def change_min_len(self, value=0):
self.min_seg_label.setText("Longeur minimale d'un segment (%.3f s)" % (float(self.min_len.value())/100))
#.........这里部分代码省略.........
示例2: __init__
# 需要导入模块: from pyqtgraph import PlotWidget [as 别名]
# 或者: from pyqtgraph.PlotWidget import setXLink [as 别名]
def __init__(self, time_series, topographies, filters, channel_names, fs, scores, scores_name='Mutual info', marks=None, *args):
super(ScoredComponentsTable, self).__init__(*args)
# attributes
self.row_items_max_height = 125
self.time_series = time_series
self.marks = marks
self.channel_names = channel_names
self.fs = fs
# set size and names
self.columns = ['Selection', scores_name, 'Topography', 'Time series (push to switch mode)']
self.setColumnCount(len(self.columns))
self.setRowCount(time_series.shape[1])
self.setHorizontalHeaderLabels(self.columns)
# columns widgets
self.checkboxes = []
self.topographies_items = []
self.plot_items = []
self.scores = []
_previous_plot_link = None
for ind in range(self.rowCount()):
# checkboxes
checkbox = QtWidgets.QCheckBox()
self.checkboxes.append(checkbox)
self.setCellWidget(ind, self.columns.index('Selection'), checkbox)
# topographies and filters
topo_filter = TopoFilterCavas(self, self.channel_names, topographies[:, ind], filters[:, ind],
self.row_items_max_height)
self.topographies_items.append(topo_filter)
self.setCellWidget(ind, self.columns.index('Topography'), topo_filter)
# plots
plot_widget = PlotWidget(enableMenu=False)
if _previous_plot_link is not None:
plot_widget.setXLink(_previous_plot_link)
# plot_widget.setYLink(_previous_plot_link)
_previous_plot_link = plot_widget
plot_widget.plot(y=self.time_series[:, ind])
if self.marks is not None:
plot_widget.plot(y=self.marks*np.max(self.time_series[:, ind]), pen=(1,3))
plot_widget.plot(y=-self.marks * np.max(self.time_series[:, ind]), pen=(1, 3))
plot_widget.plot(x=np.arange(self.time_series.shape[0]) / fs)
plot_widget.setMaximumHeight(self.row_items_max_height)
plot_widget.plotItem.getViewBox().state['wheelScaleFactor'] = 0
self.plot_items.append(plot_widget)
self.setCellWidget(ind, 3, plot_widget)
# scores
score_widget = BarLabelWidget(scores[ind], max(scores), min(scores))
self.scores.append(score_widget)
self.setCellWidget(ind, self.columns.index(scores_name), score_widget)
# formatting
self.current_row = None
self.horizontalHeader().setStretchLastSection(True)
self.resizeColumnsToContents()
self.resizeRowsToContents()
# clickable 3 column header
self.horizontalHeader().sectionClicked.connect(self.handle_header_click)
self.is_spectrum_mode = False
# reorder
self.order = np.argsort(scores)
self.reorder()
# checkbox signals
for checkbox in self.checkboxes:
checkbox.stateChanged.connect(self.checkboxes_state_changed)
# selection context menu
header = self.horizontalHeader()
header.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
header.customContextMenuRequested.connect(self.handle_header_menu)
# ctrl+a short cut
QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_A), self).activated.connect(self.ctrl_plus_a_event)
# checkbox cell clicked
self.cellClicked.connect(self.cell_was_clicked)
示例3: Ui_MainWindow
# 需要导入模块: from pyqtgraph import PlotWidget [as 别名]
# 或者: from pyqtgraph.PlotWidget import setXLink [as 别名]
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(1670, 1030)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
#Plot widgets
self.graph_enrichrate = PlotWidget(self.centralwidget, name='rate')
self.graph_enrichrate.setGeometry(QtCore.QRect(1000, 340, 661, 631))
self.graph_enrichrate.setObjectName(_fromUtf8("graph_enrichrate"))
self.graph_rawdata = PlotWidget(self.centralwidget, name='raw')
self.graph_rawdata.setGeometry(QtCore.QRect(10, 10, 981, 961))
self.graph_rawdata.setObjectName(_fromUtf8("graph_rawdata"))
self.graph_enrichrate.setXLink('raw')
self.btn_lighton = QtGui.QPushButton(self.centralwidget)
self.btn_lighton.setGeometry(QtCore.QRect(1043, 177, 85, 28))
self.btn_lighton.setObjectName(_fromUtf8("btn_lighton"))
self.btn_lightoff = QtGui.QPushButton(self.centralwidget)
self.btn_lightoff.setGeometry(QtCore.QRect(1043, 212, 85, 28))
self.btn_lightoff.setObjectName(_fromUtf8("btn_lightoff"))
self.btn_bic = QtGui.QPushButton(self.centralwidget)
self.btn_bic.setGeometry(QtCore.QRect(1043, 37, 85, 28))
self.btn_bic.setObjectName(_fromUtf8("btn_bic"))
self.btn_cells = QtGui.QPushButton(self.centralwidget)
self.btn_cells.setGeometry(QtCore.QRect(1043, 72, 85, 28))
self.btn_cells.setObjectName(_fromUtf8("btn_cells"))
self.btn_az = QtGui.QPushButton(self.centralwidget)
self.btn_az.setGeometry(QtCore.QRect(1043, 107, 85, 28))
self.btn_az.setObjectName(_fromUtf8("btn_az"))
self.btn_ez = QtGui.QPushButton(self.centralwidget)
self.btn_ez.setGeometry(QtCore.QRect(1043, 142, 85, 28))
self.btn_ez.setObjectName(_fromUtf8("btn_ez"))
self.cells_vol = QtGui.QLineEdit(self.centralwidget)
self.cells_vol.setGeometry(QtCore.QRect(1135, 75, 58, 22))
self.cells_vol.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.cells_vol.setObjectName(_fromUtf8("cells_vol"))
self.ez_vol = QtGui.QLineEdit(self.centralwidget)
self.ez_vol.setGeometry(QtCore.QRect(1135, 145, 58, 22))
self.ez_vol.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.ez_vol.setObjectName(_fromUtf8("ez_vol"))
self.bic_vol = QtGui.QLineEdit(self.centralwidget)
self.bic_vol.setGeometry(QtCore.QRect(1135, 40, 58, 22))
self.bic_vol.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.bic_vol.setObjectName(_fromUtf8("bic_vol"))
self.az_vol = QtGui.QLineEdit(self.centralwidget)
self.az_vol.setGeometry(QtCore.QRect(1135, 110, 58, 22))
self.az_vol.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.az_vol.setObjectName(_fromUtf8("az_vol"))
self.bic_cc = QtGui.QLineEdit(self.centralwidget)
self.bic_cc.setGeometry(QtCore.QRect(1221, 40, 58, 22))
self.bic_cc.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.bic_cc.setObjectName(_fromUtf8("bic_cc"))
self.lab_bicvolunit = QtGui.QLabel(self.centralwidget)
self.lab_bicvolunit.setGeometry(QtCore.QRect(1200, 40, 16, 16))
self.lab_bicvolunit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.lab_bicvolunit.setObjectName(_fromUtf8("lab_bicvolunit"))
self.lab_bicccunit = QtGui.QLabel(self.centralwidget)
self.lab_bicccunit.setGeometry(QtCore.QRect(1286, 42, 16, 16))
self.lab_bicccunit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.lab_bicccunit.setObjectName(_fromUtf8("lab_bicccunit"))
self.lab_cellsvolunit = QtGui.QLabel(self.centralwidget)
self.lab_cellsvolunit.setGeometry(QtCore.QRect(1200, 75, 16, 16))
self.lab_cellsvolunit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.lab_cellsvolunit.setObjectName(_fromUtf8("lab_cellsvolunit"))
self.lab_cellsccunit = QtGui.QLabel(self.centralwidget)
self.lab_cellsccunit.setGeometry(QtCore.QRect(1286, 75, 36, 16))
self.lab_cellsccunit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.lab_cellsccunit.setObjectName(_fromUtf8("lab_cellsccunit"))
self.cells_cc = QtGui.QLineEdit(self.centralwidget)
self.cells_cc.setGeometry(QtCore.QRect(1221, 75, 58, 22))
self.cells_cc.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.cells_cc.setObjectName(_fromUtf8("cells_cc"))
self.lab_azvolunit = QtGui.QLabel(self.centralwidget)
self.lab_azvolunit.setGeometry(QtCore.QRect(1200, 110, 16, 16))
self.lab_azvolunit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.lab_azvolunit.setObjectName(_fromUtf8("lab_azvolunit"))
self.lab_ezvolunit = QtGui.QLabel(self.centralwidget)
self.lab_ezvolunit.setGeometry(QtCore.QRect(1200, 145, 16, 16))
self.lab_ezvolunit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.lab_ezvolunit.setObjectName(_fromUtf8("lab_ezvolunit"))
self.az_cc = QtGui.QLineEdit(self.centralwidget)
self.az_cc.setGeometry(QtCore.QRect(1221, 110, 58, 22))
self.az_cc.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.az_cc.setObjectName(_fromUtf8("az_cc"))
self.ez_cc = QtGui.QLineEdit(self.centralwidget)
self.ez_cc.setGeometry(QtCore.QRect(1221, 145, 58, 22))
self.ez_cc.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.ez_cc.setObjectName(_fromUtf8("ez_cc"))
self.lab_azccunit = QtGui.QLabel(self.centralwidget)
self.lab_azccunit.setGeometry(QtCore.QRect(1286, 110, 21, 16))
self.lab_azccunit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.lab_azccunit.setObjectName(_fromUtf8("lab_azccunit"))
self.lab_ezccunit = QtGui.QLabel(self.centralwidget)
self.lab_ezccunit.setGeometry(QtCore.QRect(1286, 145, 21, 16))
self.lab_ezccunit.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
#.........这里部分代码省略.........
示例4: Ui_MainWindow
# 需要导入模块: from pyqtgraph import PlotWidget [as 别名]
# 或者: from pyqtgraph.PlotWidget import setXLink [as 别名]
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(1670, 1030)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.centralwidget.setGeometry(QtCore.QRect(2, 2, 1661, 971))
self.gridLayout = QtGui.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout.setMargin(2)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.graph_rawdata = PlotWidget(self.centralwidget, name='raw')
self.graph_rawdata.setObjectName(_fromUtf8("graph_rawdata"))
self.verticalLayout.addWidget(self.graph_rawdata)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
self.graph_enrichrate = PlotWidget(self.centralwidget, name='rate')
self.graph_enrichrate.setXLink('raw')
self.graph_enrichrate.setObjectName(_fromUtf8("graph_enrichrate"))
self.verticalLayout.addWidget(self.graph_enrichrate)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1670, 26))
self.menubar.setObjectName(_fromUtf8("menubar"))
self.menuStart = QtGui.QMenu(self.menubar)
self.menuStart.setObjectName(_fromUtf8("menuStart"))
self.menuQuit = QtGui.QMenu(self.menubar)
self.menuQuit.setObjectName(_fromUtf8("menuQuit"))
self.menuRawdata_Graph_setup = QtGui.QMenu(self.menubar)
self.menuRawdata_Graph_setup.setObjectName(_fromUtf8("menuRawdata_Graph_setup"))
self.menuRates_setup = QtGui.QMenu(self.menubar)
self.menuRates_setup.setObjectName(_fromUtf8("menuRates_setup"))
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.actionOpen_datafile = QtGui.QAction(MainWindow)
self.actionOpen_datafile.setObjectName(_fromUtf8("actionOpen_datafile"))
self.actionQuit = QtGui.QAction(MainWindow)
self.actionQuit.setObjectName(_fromUtf8("actionQuit"))
self.actionMass32 = QtGui.QAction(MainWindow)
self.actionMass32.setCheckable(True)
self.actionMass32.setChecked(True)
self.actionMass32.setObjectName(_fromUtf8("actionMass32"))
self.actionMass40 = QtGui.QAction(MainWindow)
self.actionMass40.setCheckable(True)
self.actionMass40.setChecked(True)
self.actionMass40.setObjectName(_fromUtf8("actionMAss40"))
self.actionMass44 = QtGui.QAction(MainWindow)
self.actionMass44.setCheckable(True)
self.actionMass44.setChecked(True)
self.actionMass44.setObjectName(_fromUtf8("actionMass44"))
self.actionMass45 = QtGui.QAction(MainWindow)
self.actionMass45.setCheckable(True)
self.actionMass45.setChecked(True)
self.actionMass45.setObjectName(_fromUtf8("actionMass45"))
self.actionMass46 = QtGui.QAction(MainWindow)
self.actionMass46.setCheckable(True)
self.actionMass46.setChecked(True)
self.actionMass46.setObjectName(_fromUtf8("actionMass46"))
self.actionMass47 = QtGui.QAction(MainWindow)
self.actionMass47.setCheckable(True)
self.actionMass47.setChecked(True)
self.actionMass47.setObjectName(_fromUtf8("actionMass47"))
self.actionMass49 = QtGui.QAction(MainWindow)
self.actionMass49.setCheckable(True)
self.actionMass49.setChecked(True)
self.actionMass49.setObjectName(_fromUtf8("actionMass49"))
self.actionLog_Enrichment = QtGui.QAction(MainWindow)
self.actionLog_Enrichment.setCheckable(True)
self.actionLog_Enrichment.setChecked(True)
self.actionLog_Enrichment.setObjectName(_fromUtf8("actionLog_Enrichment"))
self.actionTotal_CO2 = QtGui.QAction(MainWindow)
self.actionTotal_CO2.setCheckable(True)
self.actionTotal_CO2.setChecked(True)
self.actionTotal_CO2.setObjectName(_fromUtf8("actionTotal_CO2"))
self.actionCheck_All = QtGui.QAction(MainWindow)
self.actionCheck_All.setObjectName(_fromUtf8("actionCheck_All"))
self.actionCheck_None = QtGui.QAction(MainWindow)
self.actionCheck_None.setObjectName(_fromUtf8("actionCheck_None"))
self.actionEnrichment_rate_47 = QtGui.QAction(MainWindow)
self.actionEnrichment_rate_47.setCheckable(True)
self.actionEnrichment_rate_47.setChecked(True)
self.actionEnrichment_rate_47.setObjectName(_fromUtf8("actionEnrichment_rate_47"))
self.actionEnrichment_rate_49 = QtGui.QAction(MainWindow)
self.actionEnrichment_rate_49.setCheckable(True)
self.actionEnrichment_rate_49.setChecked(True)
self.actionEnrichment_rate_49.setObjectName(_fromUtf8("actionEnrichment_rate_49"))
self.actionO2_evolution = QtGui.QAction(MainWindow)
self.actionO2_evolution.setCheckable(True)
self.actionO2_evolution.setChecked(True)
self.actionO2_evolution.setObjectName(_fromUtf8("actionO2_evolution"))
self.actionD40_dt = QtGui.QAction(MainWindow)
self.actionD40_dt.setCheckable(True)
#.........这里部分代码省略.........