本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg类的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QTAgg类的具体用法?Python NavigationToolbar2QTAgg怎么用?Python NavigationToolbar2QTAgg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NavigationToolbar2QTAgg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_toolbar
def _init_toolbar(self):
selectAction = self.addAction(QIcon(":/plugins/spatialplot/action.png"), 'Select Features', self.select_mode)
selectAction.setToolTip('Click and drag the plot to select features in the QGIS interface.')
selectAction.setCheckable(True)
self._actions['select'] = selectAction
NavigationToolbar2QTAgg._init_toolbar(self)
示例2: __init__
def __init__(self, canvas, parent, browser):
NavigationToolbar2QTAgg.__init__(self,canvas,parent)
for c in self.findChildren(QtGui.QToolButton):
#print str(c.text())
if str(c.text()) in ('Subplots','Customize','Back','Forward','Home'):
c.defaultAction().setVisible(False)
self.parent = parent
self.browser = browser
示例3: __init__
def __init__(self, *args, **kwargs):
NavigationToolbar2QTAgg.__init__(self, *args, **kwargs)
self.init_buttons()
self.panAction.setCheckable(True)
self.zoomAction.setCheckable(True)
# remove the subplots action
self.removeAction( self.subplotsAction )
示例4: MplCanvas
class MplCanvas(FigureCanvas):
def __init__(self, parent=None, width=5, height=4, dpi=100):
matplotlib.rcParams['font.size'] = 8
self.figure = Figure(figsize=(width, height), dpi=dpi)
self.axes = self.figure.add_subplot(111)
FigureCanvas.__init__(self, self.figure)
self.setParent(parent)
self.toolbar = NavigationToolbar(self, parent)
self.toolbar.setIconSize(QSize(16, 16))
FigureCanvas.setSizePolicy(self,
QSizePolicy.Expanding,
QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
def getToolbar(self):
return self.toolbar
def clear(self):
self.figure.clear()
self.axes = self.figure.add_subplot(111)
def test(self):
self.axes.plot([1,2,3,4])
def saveAs(self, fname):
self.figure.savefig(fname)
示例5: plotwidget
class plotwidget(FigureCanvas):
def __init__(self, parent, width=12, height=6, dpi=72, projection3d=False):
#plotdata can be 2d array for image plot or list of 2 1d arrays for x-y plot or 2d array for image plot or list of lists of 2 1D arrays
self.fig=Figure(figsize=(width, height), dpi=dpi)
if projection3d:
self.axes=self.fig.add_subplot(111, navigate=True, projection='3d')
else:
self.axes=self.fig.add_subplot(111, navigate=True)
self.axes.hold(True)
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
#self.parent=parent
FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
#NavigationToolbar(self, parent)
self.toolbar=NavigationToolbar(self.figure.canvas, self)
self.toolbar.setMovable(True)#DOESNT DO ANYTHING
self.mpl_connect('button_press_event', self.myclick)
self.clicklist=[]
def myclick(self, event):
if not (event.xdata is None or event.ydata is None):
arrayxy=[event.xdata, event.ydata]
print 'clicked on image: array indeces ', arrayxy, ' using button', event.button
self.clicklist+=[arrayxy]
self.emit(SIGNAL("genericclickonplot"), [event.xdata, event.ydata, event.button])
示例6: __init__
def __init__(self, widgimage, parent=None):
#print 'ImgSpeNavToolBar.__init__'
self.widgimage = widgimage
self.canvas = self.widgimage.getCanvas()
fig = self.canvas.figure
fig.ntbZoomIsOn = False
NavigationToolbar.__init__( self, self.canvas, parent )
示例7: __init__
class MatplotlibPlot:
""" Class encapsulating a matplotlib plot"""
def __init__(self, parent = None, dpi = 100, size = (5,5)):
""" Class initialiser """
self.dpi = dpi
self.figure = Figure(size, dpi = self.dpi)
self.canvas = FigureCanvas(self.figure)
self.canvas.setParent(parent)
# Create the navigation toolbar, tied to the canvas
self.toolbar = NavigationToolbar(self.canvas, parent)
self.canvas.show()
self.toolbar.show()
# Reset the plot landscape
self.figure.clear()
def plotMultiPixel(self, info, data):
""" Generate multi-pixel plot """
# Tabula Rasa
self.figure.clear()
rows = math.ceil(math.sqrt(info['nbeams']))
# Display a subplot per beam (randomly for now)
for i in range(info['nbeams']):
ax = self.figure.add_subplot(rows, rows, i)
ax.plot(data[:,512,i])
def updatePlot(self):
self.canvas.draw()
示例8: home
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)
示例9: __init__
def __init__(self,canvas,parent):
#NavigationToolbar.__init__(self,parent,canevas)
#self.layout = QVBoxLayout( self )
self.canvas = canvas
#QtGui.QWidget.__init__(self, parent)
#self.layout.setMargin( 2 )
#self.layout.setSpacing( 0 )
NavigationToolbar.__init__(self, canvas, canvas)
示例10: __init__
def __init__(self, parent, canvas):
""" Initialization
"""
NavigationToolbar2.__init__(self, canvas, canvas)
self._myParent = parent
self._navigationMode = MyNavigationToolbar.NAVIGATION_MODE_NONE
return
示例11: MplWidgetT
class MplWidgetT(QtGui.QWidget):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
self.canvas = MplCanvas()
self.ntb = NavigationToolbar(self.canvas, self)
self.ntb.setIconSize(QtCore.QSize(16, 16))
self.vbl = QtGui.QVBoxLayout()
self.vbl.addWidget(self.canvas)
self.vbl.addWidget(self.ntb)
self.setLayout(self.vbl)
示例12: _update_view
def _update_view(self):
"""
view update called by home(), back() and forward()
:return:
"""
NavigationToolbar2._update_view(self)
self._myParent.evt_view_updated()
return
示例13: draw
def draw(self):
"""
Canvas is drawn called by pan(), zoom()
:return:
"""
NavigationToolbar2.draw(self)
self._myParent.evt_view_updated()
return
示例14: NewFigure_proc
def NewFigure_proc(self):
widget = QtGui.QWidget(self.MainFigTabWidget)
vlay = QtGui.QVBoxLayout(widget)
self.Figures.append(MplWidget(widget))
ntb = NavToolbar(self.Figures[-1], parent = widget)
ntb.setIconSize(QtCore.QSize(15,15))
vlay.setSpacing(0)
vlay.setMargin(0)
vlay.addWidget(self.Figures[-1])
vlay.addWidget(ntb)
widget.setLayout(vlay)
self.MainFigTabWidget.addTab(widget, 'Figure '+str(len(self.Figures)))
widget.setObjectName(str(self.MainFigTabWidget.count()))
self.Figures[-1].setObjectName(str(self.MainFigTabWidget.count()))
示例15: __init__
def __init__(self, plugin, parent=None):
QWidget.__init__(self, parent)
self.setupUi(self)
self.plugin = plugin
self.inputs = plugin.inputs
self.settings = QSettings("NextGIS", "MOLUSCE")
# init plot for learning curve
self.figure = Figure()
self.axes = self.figure.add_subplot(111)
self.figure.suptitle(self.tr("Neural Network learning curve"))
self.canvas = FigureCanvas(self.figure)
self.mpltoolbar = NavigationToolbar(self.canvas, None)
lstActions = self.mpltoolbar.actions()
self.mpltoolbar.removeAction(lstActions[7])
self.layoutPlot.addWidget(self.canvas)
self.layoutPlot.addWidget(self.mpltoolbar)
# and configure matplotlib params
rcParams['font.serif'] = "Verdana, Arial, Liberation Serif"
rcParams['font.sans-serif'] = "Tahoma, Arial, Liberation Sans"
rcParams['font.cursive'] = "Courier New, Arial, Liberation Sans"
rcParams['font.fantasy'] = "Comic Sans MS, Arial, Liberation Sans"
rcParams['font.monospace'] = "Courier New, Liberation Mono"
self.btnTrainNetwork.clicked.connect(self.trainNetwork)
self.manageGui()