本文整理汇总了Python中matplotlib.figure.Figure.add_axis方法的典型用法代码示例。如果您正苦于以下问题:Python Figure.add_axis方法的具体用法?Python Figure.add_axis怎么用?Python Figure.add_axis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.figure.Figure
的用法示例。
在下文中一共展示了Figure.add_axis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import add_axis [as 别名]
class WidgetsWrapper:
def __init__(self):
self.widgets = gtk.glade.XML('mpl_with_glade.glade')
self.widgets.signal_autoconnect(GladeHandlers.__dict__)
self.figure = Figure(figsize=(8,6), dpi=72)
self.axis = Subplot(self.figure, 111)
self.figure.add_axis(self.axis)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)
self.axis.plot(t,s)
self.axis.set_xlabel('time (s)')
self.axis.set_ylabel('voltage')
self.canvas = FigureCanvasGTK(self.figure) # a gtk.DrawingArea
self.canvas.show()
self['vboxMain'].pack_start(self.canvas, gtk.TRUE, gtk.TRUE)
self['vboxMain'].show()
# below is optional if you want the navigation toolbar
self.navToolbar = NavigationToolbar(self.canvas, self['windowMain'])
self.navToolbar.lastDir = '/var/tmp/'
self['vboxMain'].pack_start(self.navToolbar)
self.navToolbar.show()
sep = gtk.HSeparator()
sep.show()
self['vboxMain'].pack_start(sep, gtk.TRUE, gtk.TRUE)
self['vboxMain'].reorder_child(self['buttonClickMe'],-1)
def __getitem__(self, key):
return self.widgets.get_widget(key)
示例2: subplot_demo
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import add_axis [as 别名]
def subplot_demo():
f = Figure()
t = numpy.arange(0.0,3.0,0.01)
s1 = numpy.sin(2*numpy.pi*t)
s2 = numpy.zeros(t.shape, numpy.Float)
a1 = Subplot(211)
a1.plot(t,s1)
a1.set_title('And now for something completely different')
a2 = Subplot(212)
a2.plot(t,s2)
a2.set_xlabel('time (s)')
f.add_axis(a1)
f.add_axis(a2)
f.show()
示例3: Figure
# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import add_axis [as 别名]
win = gtk.Window()
win.set_name("Embedding in GTK")
win.connect("destroy", gtk.mainquit)
win.set_border_width(5)
vbox = gtk.VBox(spacing=3)
win.add(vbox)
vbox.show()
fig = Figure(figsize=(5,4), dpi=100)
ax = Subplot(fig, 111)
t = arange(0.0,3.0,0.01)
s = sin(2*pi*t)
ax.plot(t,s)
ax.set_title('click on line or text')
fig.add_axis(ax)
canvas = PickerCanvas(fig)
canvas.show()
vbox.pack_start(canvas)
toolbar = NavigationToolbar(canvas, win)
toolbar.show()
vbox.pack_start(toolbar, gtk.FALSE, gtk.FALSE)
win.show()
gtk.mainloop()