本文整理汇总了Python中matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.addAction方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasQTAgg.addAction方法的具体用法?Python FigureCanvasQTAgg.addAction怎么用?Python FigureCanvasQTAgg.addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg
的用法示例。
在下文中一共展示了FigureCanvasQTAgg.addAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import addAction [as 别名]
def __init__(self, parent=None, width=9, height=6, dpi=None):
self.fig = Figure(figsize=(width, height), facecolor=(.94,.94,.94), dpi=dpi)
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
QSizePolicy.Expanding,
QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
self.axes = self.fig.add_axes([0.06, 0.10, 0.9, 0.85], facecolor=(.94,.94,.94))
self.compute_initial_figure()
# horizontal x range span
axxspan = self.fig.add_axes([0.06, 0.05, 0.9, 0.02])
axxspan.axis([-0.2, 1.2, -0.2, 1.2])
axxspan.tick_params('y', labelright = False ,labelleft = False ,length=0)
self.xspan = SpanSelector(axxspan, self.onselectX, 'horizontal',useblit=True, span_stays=True, rectprops=dict(alpha=0.5, facecolor='blue'))
# vertical y range span
axyspan = self.fig.add_axes([0.02, 0.10, 0.01, 0.85])
axyspan.axis([-0.2, 1.2, -0.2, 1.2])
axyspan.tick_params('x', labelbottom = False ,labeltop = False ,length=0)
self.yspan = SpanSelector(axyspan, self.onselectY, 'vertical',useblit=True, span_stays=True, rectprops=dict(alpha=0.5, facecolor='blue'))
# reset x y spans
axReset = self.fig.add_axes([0.01, 0.05, 0.03, 0.03],frameon=False, )
self.bnReset = Button(axReset, 'Reset')
self.bnReset.on_clicked( self.xyReset )
# contextMenu
acExportPlot = QAction(self.tr("Export plot"), self)
FigureCanvas.connect(acExportPlot,SIGNAL('triggered()'), self, SLOT('exportPlot()') )
FigureCanvas.addAction(self, acExportPlot )
FigureCanvas.setContextMenuPolicy(self, Qt.ActionsContextMenu )
示例2: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import addAction [as 别名]
def __init__(self, parent=None, width=9, height=6, dpi=None):
self.fig = Figure(figsize=(width, height), facecolor=(.94,.94,.94), dpi=dpi)
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
QSizePolicy.Expanding,
QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
# contextMenu
acExportPlot = QAction(self.tr("Export plot"), self)
FigureCanvas.connect(acExportPlot,SIGNAL('triggered()'), self, SLOT('exportPlot()') )
FigureCanvas.addAction(self, acExportPlot )
FigureCanvas.setContextMenuPolicy(self, Qt.ActionsContextMenu )