本文整理汇总了Python中pyqtgraph.PlotWidget.hide方法的典型用法代码示例。如果您正苦于以下问题:Python PlotWidget.hide方法的具体用法?Python PlotWidget.hide怎么用?Python PlotWidget.hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.PlotWidget
的用法示例。
在下文中一共展示了PlotWidget.hide方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CamViewer
# 需要导入模块: from pyqtgraph import PlotWidget [as 别名]
# 或者: from pyqtgraph.PlotWidget import hide [as 别名]
class CamViewer(Display):
# Emitted when the user changes the value.
roi_x_signal = Signal(str)
roi_y_signal = Signal(str)
roi_w_signal = Signal(str)
roi_h_signal = Signal(str)
def __init__(self, parent=None, args=None):
super(CamViewer, self).__init__(parent=parent, args=args)
# Set up the list of cameras, and all the PVs
test_dict = { "image": "ca://MTEST:Image", "max_width": "ca://MTEST:ImageWidth", "max_height": "ca://MTEST:ImageWidth", "roi_x": None, "roi_y": None, "roi_width": None, "roi_height": None }
# self.cameras = { "VCC": vcc_dict, "C-Iris": c_iris_dict, "Test": test_dict }
self.cameras = {"Testing IOC Image": test_dict }
self._channels = []
self.imageChannel = None
# Populate the camera combo box
self.ui.cameraComboBox.clear()
for camera in self.cameras:
self.ui.cameraComboBox.addItem(camera)
# When the camera combo box changes, disconnect from PVs, re-initialize, then reconnect.
self.ui.cameraComboBox.activated[str].connect(self.cameraChanged)
# Set up the color map combo box.
self.ui.colorMapComboBox.clear()
for key, map_name in cmap_names.items():
self.ui.colorMapComboBox.addItem(map_name, userData=key)
self.ui.imageView.colorMap = self.ui.colorMapComboBox.currentData()
self.ui.colorMapComboBox.activated[str].connect(self.colorMapChanged)
# Set up the color map limit sliders and line edits.
# self._color_map_limit_sliders_need_config = True
self.ui.colorMapMinSlider.valueChanged.connect(self.setColorMapMin)
self.ui.colorMapMaxSlider.valueChanged.connect(self.setColorMapMax)
self.ui.colorMapMinLineEdit.returnPressed.connect(self.colorMapMinLineEditChanged)
self.ui.colorMapMaxLineEdit.returnPressed.connect(self.colorMapMaxLineEditChanged)
# Set up the stuff for single-shot and average modes.
self.ui.singleShotRadioButton.setChecked(True)
self._average_mode_enabled = False
self.ui.singleShotRadioButton.clicked.connect(self.enableSingleShotMode)
self.ui.averageRadioButton.clicked.connect(self.enableAverageMode)
self.ui.numShotsLineEdit.returnPressed.connect(self.numAverageChanged)
# Add a plot for vertical lineouts
self.yLineoutPlot = PlotWidget()
self.yLineoutPlot.setMaximumWidth(80)
self.yLineoutPlot.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
self.yLineoutPlot.getPlotItem().invertY()
self.yLineoutPlot.hideAxis('bottom')
# self.yLineoutPlot.setYLink(self.ui.imageView.getView())
self.ui.imageGridLayout.addWidget(self.yLineoutPlot, 0, 0)
self.yLineoutPlot.hide()
# We do some mangling of the .ui file here and move the imageView over a cell, kind of ugly.
self.ui.imageGridLayout.removeWidget(self.ui.imageView)
self.ui.imageGridLayout.addWidget(self.ui.imageView, 0, 1)
# Add a plot for the horizontal lineouts
self.xLineoutPlot = PlotWidget()
self.xLineoutPlot.setMaximumHeight(80)
self.xLineoutPlot.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
self.xLineoutPlot.hideAxis('left')
# self.xLineoutPlot.setXLink(self.ui.imageView.getView())
self.ui.imageGridLayout.addWidget(self.xLineoutPlot, 1, 1)
self.xLineoutPlot.hide()
# Update the lineout plot ranges when the image gets panned or zoomed
self.ui.imageView.getView().sigRangeChanged.connect(self.updateLineoutRange)
# Instantiate markers.
self.marker_dict = {1:{}, 2:{}, 3:{}, 4:{}}
marker_size = QPointF(20., 20.)
self.marker_dict[1]['marker'] = ImageMarker((0, 0), size=marker_size, pen=mkPen((100, 100, 255), width=5))
self.marker_dict[1]['button'] = self.ui.marker1Button
self.marker_dict[1]['xlineedit'] = self.ui.marker1XPosLineEdit
self.marker_dict[1]['ylineedit'] = self.ui.marker1YPosLineEdit
self.marker_dict[2]['marker'] = ImageMarker((0, 0), size=marker_size, pen=mkPen((255, 100, 100), width=5))
self.marker_dict[2]['button'] = self.ui.marker2Button
self.marker_dict[2]['xlineedit'] = self.ui.marker2XPosLineEdit
self.marker_dict[2]['ylineedit'] = self.ui.marker2YPosLineEdit
self.marker_dict[3]['marker'] = ImageMarker((0, 0), size=marker_size, pen=mkPen((60, 255, 60), width=5))
self.marker_dict[3]['button'] = self.ui.marker3Button
self.marker_dict[3]['xlineedit'] = self.ui.marker3XPosLineEdit
self.marker_dict[3]['ylineedit'] = self.ui.marker3YPosLineEdit
self.marker_dict[4]['marker'] = ImageMarker((0, 0), size=marker_size, pen=mkPen((255, 60, 255), width=5))
self.marker_dict[4]['button'] = self.ui.marker4Button
self.marker_dict[4]['xlineedit'] = self.ui.marker4XPosLineEdit
self.marker_dict[4]['ylineedit'] = self.ui.marker4YPosLineEdit
# Disable auto-ranging the image (it feels strange when the zoom changes as you move markers around.)
self.ui.imageView.getView().disableAutoRange()
for d in self.marker_dict:
marker = self.marker_dict[d]['marker']
marker.setZValue(20)
marker.hide()
marker.sigRegionChanged.connect(self.markerMoved)
#.........这里部分代码省略.........
示例2: __init__
# 需要导入模块: from pyqtgraph import PlotWidget [as 别名]
# 或者: from pyqtgraph.PlotWidget import hide [as 别名]
#.........这里部分代码省略.........
yr[0]=10**yr[0]
yr[1]=10**yr[1]
# print(xr,yr)
self._widget.plotItem.disableAutoRange()
self._widget.plotItem.setLogMode(x=False, y=False)
self._widget.plotItem.setRange(xRange=xr, yRange=yr,padding=None)
def plot1d(self, plot, xlim=None, ylim=None):
""" Plot 1D histogram
The mode defines the way the data are presented,
'histogram' is displayed with steps
'function' with continuus line
'errorbar' with yerrorbars
The norm (normalization factor) and bin_size are given
for the display purposes only. The histogram is not altered.
"""
histo = plot.histogram
self._widget = PlotWidget(viewBox=self.vb)
plt = self._widget.plotItem
plt.setTitle(histo.title)
plt.plot(histo.x_axis, histo.weights)
self._widget.show()
# if plot.mode == 'histogram':
# current_plot.plot()
# win.show()
# app.processEvents()
def _repr_png_(self):
self._widget.hide()
QtGui.QApplication.processEvents()
try:
self.image = QImage(self._widget.viewRect().size().toSize(),
QImage.Format_RGB32)
except AttributeError:
self._widget.updateGL()
self.image = self._widget.grabFrameBuffer()
painter = QPainter(self.image)
self._widget.render(painter)
byte_array = QByteArray()
buffer = QBuffer(byte_array)
buffer.open(QIODevice.ReadWrite)
self.image.save(buffer, 'PNG')
buffer.close()
return bytes(byte_array)
def xlim(self, x_range):
"""
Set x range of plot preserving y limits.
"""
if x_range==None:
yar=self._widget.plotItem.getViewBox().autoRangeEnabled()[1]
if yar==False:
yr=self._widget.viewRange()[1]
else:
yr=None