本文整理汇总了Python中matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.canvas方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasQTAgg.canvas方法的具体用法?Python FigureCanvasQTAgg.canvas怎么用?Python FigureCanvasQTAgg.canvas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg
的用法示例。
在下文中一共展示了FigureCanvasQTAgg.canvas方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProfileDockWidget
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import canvas [as 别名]
class ProfileDockWidget(QDockWidget):
"""
DockWidget class to display the profile
"""
closeSignal = pyqtSignal()
def __init__(self, iface, geometry, mntButton=False, zerosButton=False):
"""
Constructor
:param iface: interface
:param width: dock widget geometry
"""
QDockWidget.__init__(self)
self.setWindowTitle(QCoreApplication.translate("VDLTools", "Profile Tool"))
self.__iface = iface
self.__geom = geometry
self.__canvas = self.__iface.mapCanvas()
self.__types = ['PDF', 'PNG'] # ], 'SVG', 'PS']
self.__libs = []
if Qwt5_loaded:
self.__lib = 'Qwt5'
self.__libs.append('Qwt5')
if matplotlib_loaded:
self.__libs.append('Matplotlib')
elif matplotlib_loaded:
self.__lib = 'Matplotlib'
self.__libs.append('Matplotlib')
else:
self.__lib = None
self.__iface.messageBar().pushMessage(
QCoreApplication.translate("VDLTools", "No graph lib available (qwt5 or matplotlib)"),
level=QgsMessageBar.CRITICAL, duration=0)
self.__doTracking = False
self.__vline = None
self.__profiles = None
self.__numLines = None
self.__mntPoints = None
self.__marker = None
self.__tabmouseevent = None
if self.__geom is not None:
self.setGeometry(self.__geom)
self.__contentWidget = QWidget()
self.setWidget(self.__contentWidget)
self.__boxLayout = QHBoxLayout()
self.__contentWidget.setLayout(self.__boxLayout)
self.__plotFrame = QFrame()
self.__frameLayout = QHBoxLayout()
self.__plotFrame.setLayout(self.__frameLayout)
self.__printLayout = QHBoxLayout()
self.__printLayout.addWidget(self.__plotFrame)
self.__legendLayout = QVBoxLayout()
self.__printLayout.addLayout(self.__legendLayout)
self.__printWdg = QWidget()
self.__printWdg.setLayout(self.__printLayout)
self.__plotWdg = None
self.__changePlotWidget()
size = QSize(150, 20)
self.__boxLayout.addWidget(self.__printWdg)
self.__vertLayout = QVBoxLayout()
self.__libCombo = QComboBox()
self.__libCombo.setFixedSize(size)
self.__libCombo.addItems(self.__libs)
self.__vertLayout.addWidget(self.__libCombo)
self.__libCombo.currentIndexChanged.connect(self.__setLib)
if mntButton:
self.__displayMnt = False
self.__mntButton = QPushButton(QCoreApplication.translate("VDLTools", "Display MNT"))
self.__mntButton.setFixedSize(size)
self.__mntButton.clicked.connect(self.__mnt)
self.__vertLayout.addWidget(self.__mntButton)
if zerosButton:
self.__displayZeros = False
self.__zerosButton = QPushButton(QCoreApplication.translate("VDLTools", "Display Zeros"))
self.__zerosButton.setFixedSize(size)
self.__zerosButton.clicked.connect(self.__zeros)
self.__vertLayout.addWidget(self.__zerosButton)
else:
self.__displayZeros = True
self.__maxLabel = QLabel("y max")
self.__maxLabel.setFixedSize(size)
self.__vertLayout.addWidget(self.__maxLabel)
#.........这里部分代码省略.........