本文整理汇总了Python中matplotlib.backends.backend_agg.FigureCanvasAgg.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasAgg.__init__方法的具体用法?Python FigureCanvasAgg.__init__怎么用?Python FigureCanvasAgg.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_agg.FigureCanvasAgg
的用法示例。
在下文中一共展示了FigureCanvasAgg.__init__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, canvas, num, window):
FigureManagerBase.__init__(self, canvas, num)
self.window = window
self.window.withdraw()
self.set_window_title("Figure %d" % num)
self.canvas = canvas
self._num = num
_, _, w, h = canvas.figure.bbox.bounds
w, h = int(w), int(h)
self.window.minsize(int(w*3/4),int(h*3/4))
if matplotlib.rcParams['toolbar']=='classic':
self.toolbar = NavigationToolbar( canvas, self.window )
elif matplotlib.rcParams['toolbar']=='toolbar2':
self.toolbar = NavigationToolbar2TkAgg( canvas, self.window )
else:
self.toolbar = None
if self.toolbar is not None:
self.toolbar.update()
self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
self._shown = False
def notify_axes_change(fig):
'this will be called whenever the current axes is changed'
if self.toolbar != None: self.toolbar.update()
self.canvas.figure.add_axobserver(notify_axes_change)
示例2: _init_toolbar
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def _init_toolbar(self):
xmin, xmax = self.canvas.figure.bbox.intervalx
height, width = 50, xmax-xmin
Tk.Frame.__init__(self, master=self.window,
width=int(width), height=int(height),
borderwidth=2)
self.update() # Make axes menu
for text, tooltip_text, image_file, callback in self.toolitems:
if text is None:
# spacer, unhandled in Tk
pass
else:
button = self._Button(text=text, file=image_file,
command=getattr(self, callback))
if tooltip_text is not None:
ToolTip.createToolTip(button, tooltip_text)
self.message = Tk.StringVar(master=self)
self._message_label = Tk.Label(master=self, textvariable=self.message)
self._message_label.pack(side=Tk.RIGHT)
self.pack(side=Tk.BOTTOM, fill=Tk.X)
示例3: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, canvas, num, window):
FigureManagerBase.__init__(self, canvas, num)
self.window = window
self.window.withdraw()
self.set_window_title("Figure %d" % num)
self.canvas = canvas
self._num = num
if matplotlib.rcParams['toolbar']=='toolbar2':
self.toolbar = NavigationToolbar2TkAgg( canvas, self.window )
else:
self.toolbar = None
if self.toolbar is not None:
self.toolbar.update()
self.canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
self._shown = False
def notify_axes_change(fig):
'this will be called whenever the current axes is changed'
if self.toolbar != None: self.toolbar.update()
self.canvas.figure.add_axobserver(notify_axes_change)
示例4: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, figure, parent=None, coordinates=True):
if DEBUG:
print('FigureCanvasQtQuickAgg qtquick5: ', figure)
# _create_qApp()
if figure is None:
figure = Figure((6.0, 4.0))
QtQuick.QQuickPaintedItem.__init__(self, parent=parent)
FigureCanvasAgg.__init__(self, figure=figure)
self._drawRect = None
self.blitbox = None
# Activate hover events and mouse press events
self.setAcceptHoverEvents(True)
self.setAcceptedMouseButtons(QtCore.Qt.AllButtons)
self._agg_draw_pending = False
示例5: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, options):
"""Initialization."""
if options:
self.options = options
else:
Options = namedtuple('Options', 'width height label_font_size tick_font_size dpi')
self.options = Options(6, 6, 10, 8, 300)
self.set_font_size(self.options.label_font_size, self.options.tick_font_size)
self.fig = Figure(facecolor='white', dpi=self.options.dpi)
FigureCanvas.__init__(self, self.fig)
self.cid = None
self.type = '<none>'
self.name = '<none>'
self.axes_colour = (0.5, 0.5, 0.5)
示例6: __init__
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import __init__ [as 别名]
def __init__(self, options):
self.options = options
# Global plot settings
mpl.rcParams['font.size'] = self.options.font_size
mpl.rcParams['axes.titlesize'] = self.options.font_size
mpl.rcParams['axes.labelsize'] = self.options.font_size
mpl.rcParams['xtick.labelsize'] = self.options.font_size
mpl.rcParams['ytick.labelsize'] = self.options.font_size
mpl.rcParams['legend.fontsize'] = self.options.font_size
mpl.rcParams['svg.fonttype'] = 'none'
self.fig = Figure(facecolor='white', dpi=options.dpi)
FigureCanvas.__init__(self, self.fig)
self.cid = None
self.type = '<none>'
self.name = '<none>'
self.axesColour = (0.5, 0.5, 0.5)