本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg.home方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QTAgg.home方法的具体用法?Python NavigationToolbar2QTAgg.home怎么用?Python NavigationToolbar2QTAgg.home使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg
的用法示例。
在下文中一共展示了NavigationToolbar2QTAgg.home方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: home
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import home [as 别名]
def home(self, *args) :
print 'Home is clicked'
fig = self.canvas.figure
fig.myXmin = None
fig.myXmax = None
fig.myYmin = None
fig.myYmax = None
NavigationToolbar.home(self)
示例2: Window
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import home [as 别名]
class Window(QtGui.QDialog):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.figure = plt.figure()
self.canvas = FigureCanvas(self.figure)
self.toolbar = NavigationToolbar(self.canvas, self)
# self.toolbar.hide()
# Just some button
self.button = QtGui.QPushButton('Plot')
self.button.clicked.connect(self.plot)
self.button1 = QtGui.QPushButton('Zoom')
self.button1.clicked.connect(self.zoom)
self.button2 = QtGui.QPushButton('Pan')
self.button2.clicked.connect(self.pan)
self.button3 = QtGui.QPushButton('Home')
self.button3.clicked.connect(self.home)
# set the layout
layout = QtGui.QVBoxLayout()
layout.addWidget(self.toolbar)
layout.addWidget(self.canvas)
layout.addWidget(self.button)
layout.addWidget(self.button1)
layout.addWidget(self.button2)
layout.addWidget(self.button3)
self.setLayout(layout)
def home(self):
self.toolbar.home()
def zoom(self):
self.toolbar.zoom()
def pan(self):
self.toolbar.pan()
def plot(self):
''' plot some random stuff '''
data = [random.random() for i in range(25)]
ax = self.figure.add_subplot(211)
ax.hold(False)
ax.plot(data, '*-')
bx = self.figure.add_subplot(212)
bx.hold(False)
bx.plot(data, '*-')
self.canvas.draw()
示例3: MPlotWidget
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import home [as 别名]
class MPlotWidget(QtGui.QWidget):
def __init__(self, parent=None):
super(MPlotWidget, self).__init__(parent)
self.figure = plt.figure()
self.canvas = FigureCanvas(self.figure)
self.toolbar = NavigationToolbar(self.canvas, self)
self.toolbar.hide()
self.plotbutton = QtGui.QPushButton('Plot')
self.zoombutton = QtGui.QPushButton('Zoom')
self.zoombutton.clicked.connect(self.zoom)
self.panbutton = QtGui.QPushButton('Pan')
self.panbutton.clicked.connect(self.pan)
self.homebutton = QtGui.QPushButton('Home')
self.homebutton.clicked.connect(self.home)
self.savebutton = QtGui.QPushButton('Save')
self.savebutton.clicked.connect(self.save)
layout = QtGui.QVBoxLayout()
layout.addWidget(self.toolbar)
layout.addWidget(self.canvas)
buttonbox = QtGui.QHBoxLayout()
buttonbox.addWidget(self.plotbutton)
buttonbox.addWidget(self.zoombutton)
buttonbox.addWidget(self.panbutton)
buttonbox.addWidget(self.homebutton)
buttonbox.addWidget(self.savebutton)
layout.addLayout(buttonbox)
self.setLayout(layout)
self.ax = self.figure.add_subplot(111)
self.ax.hold(False)
def home(self):
self.toolbar.home()
def zoom(self):
self.toolbar.zoom()
def pan(self):
self.toolbar.pan()
def save(self):
self.figure.savefig('1.png')
"""
示例4: home
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import home [as 别名]
def home(self):
""" Reset everything to default, including colormap when home pressed. """
NavigationToolbar2QTAgg.home(self)
self.parent.canvas.reset_figure()
示例5: Window
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import home [as 别名]
class Window(QtGui.QDialog):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.figure = plt.figure()
self.canvas = FigureCanvas(self.figure)
self.canvas.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
self.toolbar = NavigationToolbar(self.canvas, self)
self.toolbar.hide()
# Timestream info
self.timestreamLabel = QtGui.QLabel('Time-stream root path:')
self.timestreamText = QtGui.QLineEdit('')
self.timestreamText.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
self.timestreamDateLabel = QtGui.QLabel('Start date (yyyy_mm_dd_hh_mm_ss):')
self.timestreamDateText = QtGui.QLineEdit('')
self.timestreamDateText.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
self.timestreamTimeLabel = QtGui.QLabel('Time interval (seconds):')
self.timestreamTimeText = QtGui.QLineEdit('')
self.timestreamTimeText.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
self.initStreamTimeButton = QtGui.QPushButton('&Initialise timestream by time')
self.initStreamTimeButton.clicked.connect(self.initialiseTimestreamByTime)
self.initStreamFileButton = QtGui.QPushButton('&Initialise timestream by files')
self.initStreamFileButton.clicked.connect(self.initialiseTimestreamByFiles)
# Image loading and processing
self.loadImageButton = QtGui.QPushButton('&Load (next) image')
self.loadImageButton.clicked.connect(self.loadImage)
self.rotateImageButton = QtGui.QPushButton('&Rotate 90-deg')
self.rotateImageButton.clicked.connect(self.rotateImage90Degrees)
self.slider = QtGui.QSlider(QtCore.Qt.Horizontal)
self.slider.setFocusPolicy(QtCore.Qt.StrongFocus)
self.slider.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
self.slider.setTickPosition(QtGui.QSlider.TicksBothSides)
self.slider.setMinimum(-16)
self.slider.setMaximum(16)
self.slider.setValue(0)
self.slider.setTickInterval(4)
self.slider.setSingleStep(1)
self.slider.valueChanged.connect(self.rotateSmallAngle)
self.applySmallRotationButton = QtGui.QPushButton('&Apply')
self.applySmallRotationButton.clicked.connect(self.applySmallRotation)
self.loadCamCalibButton = QtGui.QPushButton('Load &cam. param.')
self.loadCamCalibButton.clicked.connect(self.loadCamCalib)
self.colorcardRadioButton = QtGui.QRadioButton('Select color car&d')
self.colorcardRadioButton.setChecked(False)
self.colorcardRadioButton.clicked.connect(self.selectWhat)
self.trayRadioButton = QtGui.QRadioButton('Select &tray')
self.trayRadioButton.setChecked(False)
self.trayRadioButton.clicked.connect(self.selectWhat)
self.trayRoundCheckBox = QtGui.QCheckBox('Round')
self.trayRoundCheckBox.setChecked(True)
self.potRadioButton = QtGui.QRadioButton('Select &pot')
self.potRadioButton.setChecked(False)
self.potRadioButton.clicked.connect(self.selectWhat)
self.zoomButton = QtGui.QPushButton('&Zoom')
self.zoomButton.setCheckable(True)
self.zoomButton.clicked.connect(self.zoom)
self.panButton = QtGui.QPushButton('&Pan')
self.panButton.setCheckable(True)
self.panButton.clicked.connect(self.pan)
self.homeButton = QtGui.QPushButton('&Home')
self.homeButton.clicked.connect(self.home)
self.correctColorButton = QtGui.QPushButton('Correct colo&r')
self.correctColorButton.clicked.connect(self.correctColor)
self.save2PipelineButton = QtGui.QPushButton('&Save as pipeline settings')
self.save2PipelineButton.clicked.connect(self.savePipelineSettings)
self.testPipelineButton = QtGui.QPushButton('Test &pipeline processing')
self.testPipelineButton.clicked.connect(self.testPipeline)
self.status = QtGui.QTextEdit('')
self.status.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
self.mousePosition = QtGui.QLabel('')
# set the layout
layout = QtGui.QHBoxLayout()
rightWidget = QtGui.QWidget()
buttonlayout = QtGui.QVBoxLayout(rightWidget)
buttonlayout.addWidget(self.timestreamLabel)
buttonlayout.addWidget(self.timestreamText)
buttonlayout.addWidget(self.timestreamDateLabel)
#.........这里部分代码省略.........
示例6: Window
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import home [as 别名]
class Window(QtGui.QDialog):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.figure = plt.figure()
self.canvas = FigureCanvas(self.figure)
self.canvas.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
self.toolbar = NavigationToolbar(self.canvas, self)
self.toolbar.hide()
# Just some button
self.colorcardRadioButton = QtGui.QRadioButton('Select color car&d')
self.colorcardRadioButton.setChecked(False)
self.colorcardRadioButton.clicked.connect(self.selectWhat)
self.trayRadioButton = QtGui.QRadioButton('Select &tray')
self.trayRadioButton.setChecked(False)
self.trayRadioButton.clicked.connect(self.selectWhat)
self.potRadioButton = QtGui.QRadioButton('Select &pot')
self.potRadioButton.setChecked(False)
self.potRadioButton.clicked.connect(self.selectWhat)
self.loadImageButton = QtGui.QPushButton('&Load image')
self.loadImageButton.clicked.connect(self.loadImage)
self.rotateImageButton = QtGui.QPushButton('&Rotate 90-deg')
self.rotateImageButton.clicked.connect(self.rotateImage90Degrees)
self.loadCamCalibButton = QtGui.QPushButton('Load &cam. param.')
self.loadCamCalibButton.clicked.connect(self.loadCamCalib)
self.saveGeometriesButton = QtGui.QPushButton('&Save selected geometries')
self.saveGeometriesButton.clicked.connect(self.saveSelectedGeometries)
self.saveTraysButton = QtGui.QPushButton('&Save selected tray images')
self.saveTraysButton.clicked.connect(self.saveSelectedTrayImages)
self.saveColorcadButton = QtGui.QPushButton('&Save sel. col. card images')
self.saveColorcadButton.clicked.connect(self.saveSelectedColorcardImages)
self.save2PipelineButton = QtGui.QPushButton('&Save as pipeline settings')
self.save2PipelineButton.clicked.connect(self.savePipelineSettings)
self.zoomButton = QtGui.QPushButton('&Zoom')
self.zoomButton.setCheckable(True)
self.zoomButton.clicked.connect(self.zoom)
self.panButton = QtGui.QPushButton('&Pan')
self.panButton.setCheckable(True)
self.panButton.clicked.connect(self.pan)
self.homeButton = QtGui.QPushButton('&Home')
self.homeButton.clicked.connect(self.home)
self.status = QtGui.QTextEdit('')
self.status.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
self.mousePosition = QtGui.QLabel('')
# set the layout
layout = QtGui.QHBoxLayout()
rightWidget = QtGui.QWidget()
buttonlayout = QtGui.QVBoxLayout(rightWidget)
buttonlayout.addWidget(self.loadImageButton)
buttonlayout.addWidget(self.rotateImageButton)
buttonlayout.addWidget(self.loadCamCalibButton)
buttonlayout.addWidget(self.colorcardRadioButton)
buttonlayout.addWidget(self.trayRadioButton)
buttonlayout.addWidget(self.potRadioButton)
buttonlayout.addWidget(self.zoomButton)
buttonlayout.addWidget(self.panButton)
buttonlayout.addWidget(self.homeButton)
buttonlayout.addWidget(self.saveGeometriesButton)
buttonlayout.addWidget(self.saveColorcadButton)
buttonlayout.addWidget(self.saveTraysButton)
buttonlayout.addWidget(self.save2PipelineButton)
buttonlayout.addWidget(self.status)
buttonlayout.addWidget(self.mousePosition)
rightWidget.setMaximumWidth(200)
leftLayout = QtGui.QVBoxLayout()
leftLayout.addWidget(self.toolbar)
leftLayout.addWidget(self.canvas)
layout.addWidget(rightWidget)
layout.addLayout(leftLayout)
self.setLayout(layout)
self.group = QtGui.QButtonGroup()
self.group.addButton(self.colorcardRadioButton)
self.group.addButton(self.trayRadioButton)
self.group.addButton(self.potRadioButton)
self.panMode = False
self.zoomMode = False
self.ax = None
self.plotRect = None
self.plotImg = None
self.image = None
#.........这里部分代码省略.........