本文整理汇总了Python中matplotlib.backends.backend_qt5agg.NavigationToolbar2QT.pan方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.pan方法的具体用法?Python NavigationToolbar2QT.pan怎么用?Python NavigationToolbar2QT.pan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt5agg.NavigationToolbar2QT
的用法示例。
在下文中一共展示了NavigationToolbar2QT.pan方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: matplotlibWidget
# 需要导入模块: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.NavigationToolbar2QT import pan [as 别名]
class matplotlibWidget(QWidget):
def __init__(self, parent = None):
QWidget.__init__(self, parent)
self.canvas = MplCanvas()
self.gl = QGridLayout()
alignment = Qt.Alignment()
self.gl.addWidget(self.canvas,0,0,-1,-1,alignment)
self.toolbar = NavigationToolbar(self.canvas, self)
self.toolbar.hide()
# Just some button
self.button1 = QPushButton('Zoom')
self.button1.clicked.connect(self.zoom)
self.button2 = QPushButton('Pan')
self.button2.clicked.connect(self.pan)
self.button3 = QPushButton('Home')
self.button3.clicked.connect(self.home)
self.gl.addWidget(self.toolbar,1,0,alignment)
self.gl.addWidget(self.button1,1,1,alignment)
self.gl.addWidget(self.button2,1,2,alignment)
self.gl.addWidget(self.button3,1,3,alignment)
self.setLayout(self.gl)
def home(self):
self.toolbar.home()
def zoom(self):
self.toolbar.zoom()
def pan(self):
self.toolbar.pan()
示例2: pan
# 需要导入模块: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.NavigationToolbar2QT import pan [as 别名]
def pan(self, *args):
"""
:param args:
:return:
"""
NavigationToolbar2QT.pan(self, args)
if self._myMode == NAVIGATION_MODE_PAN:
# out of pan mode
self._myMode = NAVIGATION_MODE_NONE
else:
# into pan mode
self._myMode = NAVIGATION_MODE_PAN
print('PANNED')
示例3: pan
# 需要导入模块: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.NavigationToolbar2QT import pan [as 别名]
def pan( self, *args ):
self.resetActionsState( self.panAction )
NavigationToolbar2QT.pan( self, *args )
示例4: Calibrlogger
# 需要导入模块: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.NavigationToolbar2QT import pan [as 别名]
#.........这里部分代码省略.........
def reset_settings(self):
self.ToDateTime.setDateTime(datestring_to_date('2099-12-31 23:59:59'))
self.Add2Levelmasl.setText('')
self.bestFitSearchRadius.setText('10 minutes')
#self.mpltoolbar.home()
last_calibration = self.getlastcalibration(self.obsid)
try:
if last_calibration[0][1] and last_calibration[0][0]:
self.LoggerPos.setText(str(last_calibration[0][1]))
self.FromDateTime.setDateTime(datestring_to_date(last_calibration[0][0]))
else:
self.LoggerPos.setText('')
self.FromDateTime.setDateTime(datestring_to_date('2099-12-31 23:59:59'))
except Exception as e:
utils.MessagebarAndLog.info(log_msg=ru(QCoreApplication.translate('Calibrlogger', 'Getting last calibration failed for obsid %s, msg: %s'))%(self.obsid, str(e)))
self.LoggerPos.setText('')
self.FromDateTime.setDateTime(datestring_to_date('2099-12-31 23:59:59'))
@fn_timer
def reset_cid(self):
""" Resets self.cid to an empty list and disconnects unused events """
for x in self.cid:
self.canvas.mpl_disconnect(x)
self.cid = []
@fn_timer
def catch_old_level(self):
"""Part of adjustment method 3. adjust level_masl by clicking in plot.
this part selects a line node and a y-position on the plot"""
#Run init to make sure self.meas_ts and self.head_ts is updated for the current obsid.
self.load_obsid_and_init()
self.deactivate_pan_zoom()
self.canvas.setFocusPolicy(Qt.ClickFocus)
self.canvas.setFocus()
self.calib_help.setText(ru(QCoreApplication.translate('Calibrlogger', "Select a logger node.")))
self.cid.append(self.canvas.mpl_connect('pick_event', self.set_log_pos_from_node_date_click))
@fn_timer
def catch_new_level(self):
""" Part of adjustment method 3. adjust level_masl by clicking in plot.
this part selects a y-position from the plot (normally user would select a manual measurement)."""
if self.log_pos is not None:
self.calib_help.setText(ru(QCoreApplication.translate('Calibrlogger', "Select a y position to move to.")))
self.cid.append(self.canvas.mpl_connect('button_press_event', self.set_y_pos_from_y_click))
self.calib_help.setText("")
else:
self.calib_help.setText(ru(QCoreApplication.translate('Calibrlogger', "Something wrong, click \"Current\" and try again.")))
@fn_timer
def calculate_offset(self):
""" Part of adjustment method 3. adjust level_masl by clicking in plot.
this method extracts the head from head_ts with the same date as the line node.
4. Calculating y-position - head (or level_masl) and setting self.LoggerPos.
5. Run calibration.
"""
if self.log_pos is not None and self.y_pos is not None:
utils.start_waiting_cursor()
logger_ts = self.level_masl_ts
y_pos = self.y_pos
log_pos = self.log_pos
self.y_pos = None
示例5: Ui_MainWindow
# 需要导入模块: from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.NavigationToolbar2QT import pan [as 别名]
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("Data View"))
#MainWindow.resize(539, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.splitter = QtWidgets.QSplitter(self.centralwidget)
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setObjectName(_fromUtf8("splitter"))
# File navigation
self.fileSystemModel = QtWidgets.QDirModel(self.splitter)
self.fileSystemModel.setObjectName(_fromUtf8("fileSystemModel"))
currentDir = str(QtCore.QDir.currentPath())
index = self.fileSystemModel.index(currentDir)
self.treeView = QtWidgets.QTreeView(self.splitter)
self.treeView.setObjectName(_fromUtf8("treeView"))
self.treeView.setModel(self.fileSystemModel)
if len(sys.argv)>1:
self.currentFile = currentDir + '/' + sys.argv[1]
else:
self.currentFile = None
self.recursive_expand( index, self.treeView )
tVheader = self.treeView.header()
for i in range(1,4): tVheader.hideSection(i)
self.treeView.doubleClicked.connect(self.on_treeView_doubleClicked)
# Plots tab
self.tabWidget = QtWidgets.QTabWidget(self.splitter)
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
self.tab = QtWidgets.QWidget()
self.tab.setObjectName(_fromUtf8("tab"))
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.tab)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.figure = plt.figure(figsize=(15,5))
self.canvas = FigureCanvas(self.figure)
self.canvas.setObjectName(_fromUtf8("canvas"))
self.toolbar = NavigationToolbar(self.canvas, self)
self.toolbar.hide()
self.verticalLayout_2.addWidget(self.canvas)
# Plot buttons
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout_plotButtons"))
self.plotTypeCombo = QtWidgets.QComboBox(self.tab)
self.plotTypeCombo.setObjectName(_fromUtf8("plotTypeCombo"))
self.plotTypeCombo.currentIndexChanged.connect(self.ChangePlotType)
self.horizontalLayout.addWidget(self.plotTypeCombo)
self.btnPlot = QtWidgets.QPushButton(self.tab)
self.btnPlot.setObjectName(_fromUtf8("btnPlot"))
self.btnPlot.clicked.connect(self.drawPlot)
self.horizontalLayout.addWidget(self.btnPlot)
self.btnZoom = QtWidgets.QPushButton(self.tab)
self.btnZoom.setObjectName(_fromUtf8("btnZoom"))
self.btnZoom.clicked.connect(self.plotZoom)
self.horizontalLayout.addWidget(self.btnZoom)
self.btnPan = QtWidgets.QPushButton(self.tab)
self.btnPan.setObjectName(_fromUtf8("btnPan"))
self.btnPan.clicked.connect(self.plotPan)
self.horizontalLayout.addWidget(self.btnPan)
self.btnHome = QtWidgets.QPushButton(self.tab)
self.btnHome.setObjectName(_fromUtf8("btnHome"))
self.btnHome.clicked.connect(self.plotHome)
self.horizontalLayout.addWidget(self.btnHome)
self.verticalLayout_2.addLayout(self.horizontalLayout)
# x axis options
self.horizontalLayout_xAxis = QtWidgets.QHBoxLayout()
self.horizontalLayout_xAxis.setObjectName(_fromUtf8("horizontalLayout_xAxis"))
self.xColSelect = QtWidgets.QComboBox(self.tab)
self.xColSelect.setObjectName(_fromUtf8("xColSelect"))
self.xColSelect.currentIndexChanged.connect(self.ResetUserSelections)
self.horizontalLayout_xAxis.addWidget(self.xColSelect)
self.horizontalLayout_xAxis.setStretchFactor(self.xColSelect,2)
self.xbinsLabel = QtWidgets.QLabel(self.tab)
self.xbinsLabel.setText("X Bins:")
self.horizontalLayout_xAxis.addWidget( self.xbinsLabel )
self.xnBinsSpin = QtWidgets.QSpinBox(self.tab)
self.xnBinsSpin.setObjectName(_fromUtf8("xnBinsSpin"))
self.xnBinsSpin.valueChanged.connect(self.XChangeBinning)
self.xnBinsSpin.setRange(1,10000)
self.horizontalLayout_xAxis.addWidget( self.xnBinsSpin )
self.horizontalLayout_xAxis.setStretchFactor(self.xnBinsSpin,2)
self.xminLabel = QtWidgets.QLabel(self.tab)
self.xminLabel.setText("X Min:")
self.horizontalLayout_xAxis.addWidget( self.xminLabel )
self.xnMinSpin = QtWidgets.QDoubleSpinBox(self.tab)
self.xnMinSpin.setObjectName(_fromUtf8("xnMinSpin"))
self.xnMinSpin.valueChanged.connect(self.XChangeMin)
self.xnMinSpin.setRange( -1e20, 1e20 )
self.horizontalLayout_xAxis.addWidget( self.xnMinSpin )
self.horizontalLayout_xAxis.setStretchFactor(self.xnMinSpin,2)
self.xmaxLabel = QtWidgets.QLabel(self.tab)
self.xmaxLabel.setText("X Max:")
self.horizontalLayout_xAxis.addWidget( self.xmaxLabel )
self.xnMaxSpin = QtWidgets.QDoubleSpinBox(self.tab)
#.........这里部分代码省略.........