本文整理汇总了Python中pyqtgraph.PlotWidget.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Python PlotWidget.setTitle方法的具体用法?Python PlotWidget.setTitle怎么用?Python PlotWidget.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.PlotWidget
的用法示例。
在下文中一共展示了PlotWidget.setTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Aditi
# 需要导入模块: from pyqtgraph import PlotWidget [as 别名]
# 或者: from pyqtgraph.PlotWidget import setTitle [as 别名]
#.........这里部分代码省略.........
min_int = min(min_int, min(intensities))
max_int = max(max_int, max(intensities))
self.plot_widget_tic.plot(times, intensities, pen=mkPen(color=rawfile.qcolor, width=1.3))
else:
not_database.append(str(filename))
self.plot_widget_tic.setLimits(xMin=min_time, xMax=max_time, yMin=min_int, yMax=max_int)
self.plot_widget_tic.scene().sigMouseClicked.connect(self.plot_spectrum)
if not_database:
v = "\n".join(not_database)
QMessageBox.information(self, "Error",
"The following files are not valid sqlite database:\n" + v)
@staticmethod
def get_coloured_root_item(filepath, color, colorr):
root = QStandardItem(filepath)
gradient = QLinearGradient(-100, -100, 100, 100)
gradient.setColorAt(0.7, colorr)
gradient.setColorAt(1, color)
root.setBackground(QBrush(gradient))
root.setEditable(False)
root.setCheckState(Qt.Checked)
root.setCheckable(True)
return root
def quit(self):
res = QMessageBox.warning(self, "Exiting...", "Are you sure ?", QMessageBox.Ok | QMessageBox.Cancel)
if res == QMessageBox.Cancel:
return
QtGui.qApp.quit()
def plot(self):
#clear pw
self.plot_widget_xic.clear()
# check sample checked
checked_files = [rawfile for rawfile in self.rawfiles_by_short_path.values() if rawfile.is_checked]
mz = self.xic_widget.mzSpinBox.value()
mz_tol = self.xic_widget.mzTolSpinBox.value()
mz_diff = mz * mz_tol / 1e6
min_mz, max_mz = mz - mz_diff, mz + mz_diff
#Thread implementation not as fast
# args = [(data[0], min_mz, max_mz, data[2]) for data in checked_files]
# extractor_thread = Extractor(args, self)
# extractor_thread.extracted.connect(self._plot)
# extractor_thread.start()
min_time_val, max_time_val = 10000, 0
min_int_val, max_int_val = 1e9, 0
for rawfile in checked_files:
t1 = time.clock()
times, intensities = rawfile.reader.get_xic(min_mz, max_mz)
print "elapsed: ", time.clock() - t1
# min_time_val = min(min_time_val, times[0])
# max_time_val = max(max_time_val, times[-1])
# min_int_val = min(min_int_val, min(intensities))
# max_int_val = max(max_int_val, max(intensities))
item = self.plot_widget_xic.plot(times, intensities, pen=mkPen(color=rawfile.qcolor, width=1.3))
item.curve.setClickable(True)
def on_curve_clicked():
if not rawfile.is_highlighted:
item.setPen(mkPen(color=rawfile.qcolor, width=4))
rawfile.is_highlighted = True
else:
item.setPen(mkPen(color=rawfile.qcolor, width=2))
rawfile.is_highlighted = False
item.sigClicked.connect(on_curve_clicked)
#item.sigHovered = on_curve_clicked
self.xic_by_rawfile_short_path[rawfile.short_path] = item
self.plot_widget_xic.setTitle(title="[email protected]" + str(mz))
#self.plot_widget_xic.setLimits(xMin=min_time_val, xMax=max_time_val, yMin=min_int_val, yMax=max_int_val)
def update_plot_(self):
for rawfile in self.rawfiles_by_short_path.viewvalues():
if rawfile.is_checked:
try:
self.plot_widget_xic.addItem(self.xic_by_rawfile_short_path[rawfile.short_path])
except KeyError:
mz = self.xic_widget.mzSpinBox.value()
mz_tol = self.xic_widget.mzTolSpinBox.value()
mz_diff = mz * mz_tol / 1e6
min_mz, max_mz = mz - mz_diff, mz + mz_diff
times, intensities = rawfile.reader.get_xic(min_mz, max_mz)
item = self.plot_widget_xic.plot(times, intensities, pen=mkPen(color=rawfile.qcolor, width=2))
self.xic_by_rawfile_short_path[rawfile.short_path] = item
else:
try:
#self.plot_widget_xic.removeItem(self.xic_by_rawfile_short_path[rawfile.short_path])
self.xic_by_rawfile_short_path[rawfile.short_path].hide()
except KeyError:
pass