本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QT类的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT类的具体用法?Python NavigationToolbar2QT怎么用?Python NavigationToolbar2QT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NavigationToolbar2QT类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, plotCanvas, parent, custom_actions=True):
"""
**Properties**
*_firstChange* (boolean):
Whether or not the y limits of the plots were
changed before.
*_plot_params* (dictionary):
The plot parameters given as (key, value) pare.
"""
NavigationToolbar2QTAgg.__init__(self, plotCanvas, parent)
# properties {
self._firstChange = True
self._plot_params = {}
# }
# custom actions {
if custom_actions:
self.addSeparator()
self.action_reset = self.addAction("Reset", self.onReset)
self.action_reset.setToolTip("Reset the y limits")
self.action_plus = self.addAction("+", self.onPlus)
self.action_plus.setToolTip("Expand the y limits")
self.action_minus = self.addAction("-", self.onMinus)
self.action_minus.setToolTip("Reduce the y limits")
开发者ID:INM-6,项目名称:swan,代码行数:27,代码来源:matplotlibwidget.py
示例2: __init__
def __init__(self, canvas, parent, coordinates=True):
NavigationToolbar2QT.__init__(self, canvas, parent, coordinates)
self.setIconSize(QtCore.QSize(16, 16))
self.ct = None
self.mw = None
self._idPress1 = None
self._idPress2 = None
self._idPress3 = None
开发者ID:Pengchengu,项目名称:herding-spikes,代码行数:9,代码来源:customtoolbarpca.py
示例3: __init__
def __init__(self, canvas, parent, browser):
NavigationToolbar2QT.__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'):
if str(c.text()) in ('Customize','Back','Forward'):
c.defaultAction().setVisible(False)
self.parent = parent
self.browser = browser
开发者ID:ineuron,项目名称:NeuroDAQ-Analysis,代码行数:9,代码来源:MplWidgets.py
示例4: __init__
def __init__(self, canvas, parent ):
NavigationToolbar2QT.__init__(self,canvas,parent)
self.clearButtons=[]
# Search through existing buttons
# next use for placement of custom button
next=None
for c in self.findChildren(QToolButton):
if next is None:
next=c
# Don't want to see subplots and customize
if str(c.text()) in ('Subplots','Customize','Forward', 'Back'):
c.defaultAction().setVisible(False)
continue
开发者ID:forstater,项目名称:mosaic,代码行数:13,代码来源:mplwidget.py
示例5: __init__
def __init__(self, canvas_, parent_):
override.figureoptions = None # Monkey patched to kill the figure options button on matplotlib toolbar
self.toolitems = (
('Home', 'Reset original view', 'home', 'home'),
('Save', 'Save the current image', 'filesave', 'save_figure'),
(None, None, None, None),
('Back', 'Back to previous view', 'back', 'back'),
('Forward', 'Forward to next view', 'forward', 'forward'),
(None, None, None, None),
('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'),
('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),
)
NavigationToolbar2QT.__init__(self, canvas_, parent_)
开发者ID:Unidata,项目名称:Wave,代码行数:14,代码来源:mainwindow.py
示例6: __init__
def __init__(self, canvas, parent ):
NavigationToolbar2QT.__init__(self,canvas,parent)
self.clearButtons=[]
# Search through existing buttons
# next use for placement of custom button
next=None
for c in self.findChildren(QtGui.QToolButton):
if next is None:
next=c
# Don't want to see subplots and customize
"""
if str(c.text()) in ('Subplots', 'Customize'):
c.defaultAction().setVisible(False)
continue
"""
# Need to keep track of pan and zoom buttons
# Also grab toggled event to clear checked status of picker button
if str(c.text()) in ('Pan','Zoom'):
c.toggled.connect(self.clearCurs)
self.clearButtons.append(c)
next=None
# create custom button
pm=QtGui.QPixmap(32,32)
pm.fill(QtGui.QApplication.palette().color(QtGui.QPalette.Normal,QtGui.QPalette.Button))
painter=QtGui.QPainter(pm)
painter.fillRect(6,6,20,20,QtCore.Qt.red)
painter.fillRect(15,3,3,26,QtCore.Qt.blue)
painter.fillRect(3,15,26,3,QtCore.Qt.blue)
painter.end()
icon=QtGui.QIcon(pm)
ac = self.addAction(icon, "Toggle Curs")
ac.setCheckable(True)
ac.toggled.connect(self.curs_toggle)
self.ac = ac
#button=QtGui.QToolButton(self)
#button.setDefaultAction(self.ac)
# Add it to the toolbar, and connect up event
#self.insertWidget(next.defaultAction(),button)
# Grab the picked event from the canvas
canvas.mpl_connect('pick_event',self.canvasPicked)
开发者ID:Morisset,项目名称:pySSN,代码行数:47,代码来源:pyssn_qt.py
示例7: __init__
def __init__(self, parent=None):
super(Window, self).__init__(parent)
#Variables Init
self.figure = plt.figure()
self.ax = self.figure.add_subplot(111)
canvas = FigureCanvas(self.figure)
self.mat = self.ax.matshow(np.zeros((num_rows,num_cols)))
#global ax, mat, ser, Array, data
toolbar = NavigationToolbar(canvas, self)
toolbar.hide()
# Start Button
self.button = QtGui.QPushButton('Start')
self.button.clicked.connect(plot)
#self.button1 = QtGui.QPushButton('Record')
#self.button.clicked.connect(self.plot)
# set the layout
layout = QtGui.QVBoxLayout()
layout.addWidget(canvas)
layout.addWidget(self.button)
self.setLayout(layout)
self.figure.canvas.draw()
self.timer = self.startTimer(3)
开发者ID:yuvashankar,项目名称:Capstone,代码行数:31,代码来源:QT_PY3.py
示例8: addSeventyLine
def addSeventyLine(self):
global seventyLine
if(seventyLine == True):
seventyLine = False
self.rsiGraph.setParent(None)
self.candlestick.setParent(None)
self.toolbar.setParent(None)
self.splitter1.setParent(None)
self.candlestick = mainGraphCanvas(self.main_widget)
self.rsiGraph = rsiGraphCanvas(self.main_widget)
self.toolbar = NavigationToolbar(self.candlestick, self.main_widget)
self.splitter1 = QtGui.QSplitter(QtCore.Qt.Vertical)
self.splitter1.addWidget(self.candlestick)
self.splitter1.addWidget(self.rsiGraph)
self.splitter1.addWidget(self.toolbar)
self.graphVBox.addWidget(self.splitter1)
self.rsi.show()
else:
seventyLine = True
self.rsiGraph.setParent(None)
self.candlestick.setParent(None)
self.toolbar.setParent(None)
self.splitter1.setParent(None)
self.candlestick = mainGraphCanvas(self.main_widget)
self.rsiGraph = rsiGraphCanvas(self.main_widget)
self.toolbar = NavigationToolbar(self.candlestick, self.main_widget)
self.splitter1 = QtGui.QSplitter(QtCore.Qt.Vertical)
self.splitter1.addWidget(self.candlestick)
self.splitter1.addWidget(self.rsiGraph)
self.splitter1.addWidget(self.toolbar)
self.graphVBox.addWidget(self.splitter1)
self.rsi.show()
开发者ID:han308,项目名称:TechnicalAnalysisTool,代码行数:34,代码来源:StockAnalysisApp.py
示例9: MatplotlibWidgetWFPot
class MatplotlibWidgetWFPot(QtGui.QGraphicsView):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
self.canvas = MplCanvas()
self.vbl = QtGui.QVBoxLayout()
self.vbl.addWidget(self.canvas)
self.setLayout(self.vbl)
self.canvas.ax.set_title('Calculated PCB electrode potentials', fontsize=10)
self.canvas.fig.patch.set_alpha(0)
self.mpl_toolbar = NavigationToolbar(self.canvas, self)
params = {
'legend.fontsize': 8,
'xtick.labelsize': 8,
'ytick.labelsize': 8,
'legend.handletextpad': .5,
}
plt.rcParams.update(params)
self.mpl_toolbar.pan()
def plot(self, wfPotentials, plotitems):
if hasattr(wfPotentials, 'plotTime'):
argX = wfPotentials.plotTime
argY = wfPotentials.potentialsOut
# get axis limits to not reset zoom/pan
axlim = self.canvas.ax.axis()
self.canvas.ax.clear()
if not any(plotitems):
self.canvas.draw()
return
if plotitems[0]:
self.canvas.ax.plot(argX, argY[1,:], 'r.')
self.canvas.ax.plot(argX, argY[1,:], 'r', label="2", linewidth=1.2)
if plotitems[1]:
self.canvas.ax.plot(argX, argY[3,:], 'b.')
self.canvas.ax.plot(argX, argY[3,:], 'b', label="4", linewidth=1.2)
if plotitems[2]:
self.canvas.ax.plot(argX, argY[5,:], 'g.')
self.canvas.ax.plot(argX, argY[5,:], 'g', label="6", linewidth=1.2)
if not axlim == (0.0, 1.0, 0.0, 1.0):
self.canvas.ax.axis(axlim)
else: pass
self.canvas.ax.grid(True)
self.canvas.ax.set_title("Calculated PCB electrode potentials", fontsize=10)
self.canvas.ax.set_xlabel("Time ($\mu$s)", fontsize=10)
self.canvas.ax.set_ylabel("Amplitude (bits)", fontsize=10)
self.canvas.ax.legend(bbox_to_anchor=(0.02, 0.99), loc=2, borderpad=None, borderaxespad=0., fontsize=8, frameon=False)
# mares in potential generation
self.canvas.ax.plot([wfPotentials.incplTime,wfPotentials.incplTime],[(wfPotentials.maxAmp*2+50),-50], 'k--', linewidth=1.5)
self.canvas.ax.plot([wfPotentials.plotTime[-1]-wfPotentials.outcplTime, wfPotentials.plotTime[-1]-wfPotentials.outcplTime], \
[-1,wfPotentials.maxAmp*2+1], 'k--', linewidth=1.5)
#self.WaveformDisplay.canvas.ax.plot([wfPotentials.incplTime+wfPotentials.decelTime,\
#wfPotentials.incplTime+wfPotentials.decelTime],[wfPotentials.maxAmp*-2-1, wfPotentials.maxAmp*2+1], 'k--', linewidth=1)
self.canvas.fig.patch.set_alpha(0)
self.canvas.fig.tight_layout()
self.canvas.draw()
else:
print 'No potentials generated'
开发者ID:mikekohlhoff,项目名称:ryexpctl,代码行数:59,代码来源:MatplotlibWidgetWFPot.py
示例10: __init__
def __init__(self, parent, canvas):
""" Initialization
"""
NavigationToolbar2.__init__(self, canvas, canvas)
self._myParent = parent
self._navigationMode = MyNavigationToolbar.NAVIGATION_MODE_NONE
return
开发者ID:mducle,项目名称:mantid,代码行数:9,代码来源:mpl2dgraphicsview.py
示例11: __init__
def __init__(self, canvas, window, profile=True):
self.toolitems = list(self.toolitems)
self.toolitems.insert(6, ('Profile', 'Get the profile of a line in an image',
os.path.join(imgutils.RESSOURCE_PATH, "profile"), 'profile'))
self.toolitems.insert(7, ('Stats', 'Get statistics on a portion of an image/line',
os.path.join(imgutils.RESSOURCE_PATH, "stats"), 'stats'))
NavigationToolbar.__init__(self, canvas, window)
self._actions['profile'].setCheckable(True)
self._actions['stats'].setCheckable(True)
开发者ID:flomertens,项目名称:libwise,代码行数:9,代码来源:plotutils_ui.py
示例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
开发者ID:mducle,项目名称:mantid,代码行数:10,代码来源:mpl2dgraphicsview.py
示例13: draw
def draw(self):
"""
Canvas is drawn called by pan(), zoom()
:return:
"""
NavigationToolbar2.draw(self)
self._myParent.evt_view_updated()
return
开发者ID:mducle,项目名称:mantid,代码行数:10,代码来源:mpl2dgraphicsview.py
示例14: 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)
开发者ID:frozenblit,项目名称:herding-spikes,代码行数:10,代码来源:mplwidget.py
示例15: __init__
def __init__(self , parent , canvas , orientation = Qt.Vertical,
close_button = False) :
"""
A simple matplotlib navigation toolbar that can be vertical
Qt.Vertical or Qt.Horizontal
"""
NavigationToolbar2.__init__( self, canvas,parent )
self.setOrientation(orientation)
if close_button:
self.addSeparator()
self.actionClose = self.addAction(QIcon(':/window-close.png'), 'Close')
开发者ID:AntoineValera,项目名称:SynaptiQs,代码行数:11,代码来源:enhancedmatplotlib.py
示例16: Mpl
class Mpl(QtGui.QWidget, Ui_Form):
def __init__(self, fig_dict, name_list):
super(Mpl, self).__init__()
self.setupUi(self)
self.fig_dict = fig_dict
self.name_list = name_list
self.index = 0
self.btnBack.clicked.connect(self.back)
self.btnForward.clicked.connect(self.forward)
self.comboBoxSelect.addItems(self.name_list)
self.comboBoxSelect.setCurrentIndex(self.index)
self.comboBoxSelect.activated.connect(self.select)
if self.fig_dict and self.name_list:
fig = self.fig_dict[self.name_list[self.index]]
else:
fig = Figure()
self.addmpl(fig)
def changefig(self,):
self.comboBoxSelect.setCurrentIndex(self.index)
fig = self.fig_dict[self.name_list[self.index]]
self.rmmpl()
self.addmpl(fig)
def addmpl(self, fig):
self.canvas = FigureCanvas(fig)
# self.canvas.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
self.ltMPL.addWidget(self.canvas)
self.canvas.draw()
self.toolbar = NavigationToolbar(self.canvas,
self.wgtToolbox, coordinates=True)
self.ltToolbox.addWidget(self.toolbar)
def rmmpl(self,):
self.ltMPL.removeWidget(self.canvas)
self.canvas.close()
self.ltToolbox.removeWidget(self.toolbar)
self.toolbar.close()
def back(self):
self.index = self.index-1 if self.index!=0 else len(self.name_list)-1
self.changefig()
def forward(self):
self.index = self.index+1 if self.index!=len(self.name_list)-1 else 0
self.changefig()
def select(self):
self.index = self.comboBoxSelect.currentIndex()
self.changefig()
开发者ID:sig-app,项目名称:PlotViewer,代码行数:53,代码来源:MplCtrl.py
示例17: __init__
def __init__(self, on_changed_ev, parent=None):
super(ThresholdCacheWidget, self).__init__()
self.on_changed_ev = on_changed_ev
self.parent = parent
self.histogram_figure = plt.figure()
self.histogram_canvas = FigureCanvas(self.histogram_figure)
self.histogram_canvas.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
self.histogram_canvas.setMinimumSize(50, 50)
self.histogram_toolbar = NavigationToolbar(self.histogram_canvas, parent)
self.histogram_toolbar.coordinates = False
self.histogram_toolbar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
self.image_figure = plt.figure()
self.image_canvas = FigureCanvas(self.image_figure)
self.image_canvas.setMinimumSize(50, 50)
self.image_canvas.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
self.image_toolbar = NavigationToolbar(self.image_canvas, parent)
self.image_toolbar.coordinates = False
self.image_toolbar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
gs = grd.GridSpec(3, 1)
self.ax_objects = self.histogram_figure.add_subplot(gs[0, 0])
self.ax_area = self.histogram_figure.add_subplot(gs[1, 0], sharex=self.ax_objects)
self.ax_image = self.image_figure.add_subplot(111)
layout = QtGui.QGridLayout()
q1 = QtGui.QLabel("<b>Choose Threshold</b>")
layout.addWidget(q1, 0, 0, 1, 1)
layout.addWidget(QtGui.QLabel("Click on either graph to pick a threshold value"), 1, 0, 1, 1)
layout.addWidget(self.histogram_canvas, 3, 0, 1, 1)
layout.addWidget(self.histogram_toolbar, 4, 0, 1, 1)
self.roiSelectorBar = ROISelectorBar(self.image_figure, self.ax_image)
self.roiSelectorBar.roi_changed.connect(self.roiSelectorBar_roi_changed)
self.calibrationBar = CalibrationBar(10, self.image_figure, self.ax_image)
self.calibrationBar.calibration_changed.connect(self.calibrationBar_calibration_changed)
q2 = QtGui.QLabel("<b>Define Region of Interest</b>")
layout.addWidget(q2, 0, 1, 1, 1)
layout.addWidget(self.roiSelectorBar, 1, 1, 1, 1)
layout.addWidget(self.calibrationBar, 2, 1, 1, 1)
layout.addWidget(self.image_canvas, 3, 1, 1, 1)
layout.addWidget(self.image_toolbar, 4, 1, 1, 1)
self.setLayout(layout)
self.histogram_figure.canvas.mpl_connect('button_press_event', self.on_histogram_button_pressed)
# self.image_figure.canvas.mpl_connect('button_press_event', self.on_image_button_pressed)
self.thresholds = []
开发者ID:amarallab,项目名称:waldo,代码行数:52,代码来源:widgets.py
示例18: _initToolbar
def _initToolbar(self):
toolbar = NavigationToolbar(self._canvas, self.parent())
act_save = toolbar._actions['save_figure']
act_copy = QAction(getIcon('edit-copy'), 'Copy', toolbar)
toolbar.insertAction(act_save, act_copy)
# Signals
act_save.triggered.disconnect(toolbar.save_figure)
act_save.triggered.connect(self.save)
act_copy.triggered.connect(self.copy)
return toolbar
开发者ID:pymontecarlo,项目名称:pymontecarlo-gui,代码行数:15,代码来源:results.py
示例19: zoom
def zoom(self, *args):
"""
Turn on/off zoom (zoom button)
:param args:
:return:
"""
NavigationToolbar2.zoom(self, args)
if self._navigationMode == MyNavigationToolbar.NAVIGATION_MODE_ZOOM:
# out of zoom mode
self._navigationMode = MyNavigationToolbar.NAVIGATION_MODE_NONE
else:
# into zoom mode
self._navigationMode = MyNavigationToolbar.NAVIGATION_MODE_ZOOM
return
开发者ID:mducle,项目名称:mantid,代码行数:16,代码来源:mpl2dgraphicsview.py
示例20: __init__
def __init__(self, parent = None):
QWidget.__init__(self, parent)
self.canvas = MplCanvas()
self.vbl = QVBoxLayout()
self.vbl.addWidget(self.canvas)
self.setLayout(self.vbl)
self.canvas.ax.set_title('Series of Averages', fontsize=12)
self.canvas.fig.patch.set_alpha(0)
self.canvas.fig.tight_layout()
self.mpl_toolbar = NavigationToolbar(self.canvas, self)
self.canvas.mpl_connect('button_press_event', self.onclick)
self.mpl_toolbar.pan()
params = {
'xtick.labelsize': 12,
'ytick.labelsize': 12,
'figure.autolayout': True,
}
plt.rcParams.update(params)
self.data = []
self.distmeshsurf = 1.
if sys.platform == 'darwin':
self.filePath = '/Users/TPSGroup/Documents/Experimental Data/Data Mike/Raw Data/2015'
else:
self.filePath = 'C:\\Users\\tpsgroup\\Desktop\\Documents\\Data Mike\\Raw Data\\2015'
self.trace = [False, False, False, False]
开发者ID:mikekohlhoff,项目名称:PythonScriptsEval,代码行数:25,代码来源:MatplotlibWidgetWL.py
注:本文中的matplotlib.backends.backend_qt4agg.NavigationToolbar2QT类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论