本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QT.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT.__init__方法的具体用法?Python NavigationToolbar2QT.__init__怎么用?Python NavigationToolbar2QT.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.NavigationToolbar2QT
的用法示例。
在下文中一共展示了NavigationToolbar2QT.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
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")
示例2: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
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)
示例3: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
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
示例4: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
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
示例5: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
def __init__(self, parent, canvas):
""" Initialization
"""
NavigationToolbar2.__init__(self, canvas, canvas)
self._myParent = parent
self._navigationMode = MyNavigationToolbar.NAVIGATION_MODE_NONE
return
示例6: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
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')
示例7: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
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
示例8: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
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_)
示例9: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
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)
示例10: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
def __init__(self,canvas_,parentframe_,parclass):
self.parclass = parclass
# images: Python34\Lib\site-packages\matplotlib\mpl-data\images
self.toolitems = (
('Home', 'original scale', 'home', 'home'),
#('Back', 'consectetuer adipiscing elit', 'back', 'back'),
#('Forward', 'sed diam nonummy nibh euismod', 'forward', 'forward'),
(None, None, None, None),
('Pan', 'pan', 'move', 'pan'),
(None, None, None, None),
('Zoom', 'zoom', 'zoom_to_rect', 'zoom'),
(None, None, None, None),
(None, None, None, None),
('Cursor','Cursor','cursor','onCursor'),
(None, None, None, None),
)
NavigationToolbar.__init__(self,canvas_,parentframe_,False)
示例11: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
def __init__(self, parent, canvas):
""" Initialization
FUTURE: direction='h'
"""
self.canvas = canvas
QtGui.QWidget.__init__(self, parent)
#if direction=='h' :
# self.layout = QtGui.QHBoxLayout(self)
#else :
# self.layout = QtGui.QVBoxLayout(self)
#self.layout.setMargin(2)
#self.layout.setSpacing(0)
NavigationToolbar.__init__( self, canvas, canvas )
return
示例12: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
def __init__(self,canvas,parent,figure,remove=[]):
self.canvas = canvas
self.figure = figure
self.span = {}
self.toolitems = (
('Home', 'Reset original view', 'home', 'home'),
('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'),
(None, None, None, None),
('Subplots', 'Configure subplots', 'subplots', 'configure_subplots'),
('Save', 'Save the figure', 'filesave', 'save_figure'),
('Csv Save', 'Save data to CSV File', '', 'csv_save'),
('Legend', 'Toggle legend', '', 'legend_switch'),
('Hold', 'Hold graph', '', 'hold_figure'),
('Cut', 'Cut figure', '', 'cut_figure'),
)
NavigationToolbar2QT.__init__(self,canvas,parent)
actions = self.findChildren(QtGui.QAction)
self._actions["csv_save"].setIcon(QtGui.QIcon("images/CSV.png"))
self._actions["legend_switch"].setIcon(QtGui.QIcon("images/legend.png"))
self._actions["hold_figure"].setIcon(QtGui.QIcon("images/toggle.png"))
self._actions["cut_figure"].setIcon(QtGui.QIcon("images/Cut.png"))
self._actions["cut_figure"].setCheckable(1)
self._actions["legend_switch"].setCheckable(1)
self._actions["hold_figure"].setCheckable(1)
for a in actions:
if a.text() == 'Customize':
self.removeAction(a)
break
for i in remove:
self._actions[i].hide()
self._actions["hold_figure"].setChecked(config["hold_graph_on_start"])
示例13: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
def __init__(self, *args, **kwargs):
NavigationToolbar.__init__(self, *args, **kwargs)
示例14: __init__
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QT import __init__ [as 别名]
def __init__(self, canvas, parent, tools=('Home', 'Pan', 'Zoom', 'Save'), **kwargs):
matplotlib.backends.backend_qt4.figureoptions = None
matplotlib.backends.backend_qt5.figureoptions = None
self.toolitems = [t for t in NavigationToolbar2QT.toolitems if t[0] in tools]
NavigationToolbar2QT.__init__(self, canvas, parent, **kwargs)