get_children
を使用すると、子オブジェクトのみが取得されますが、これらのオブジェクトは独自の子を持つ可能性があります。
import matplotlib.pyplot as plt
def get_info(obj):
if 'get_children' in dir(obj):
for o in obj.get_children():
print o
if('get_path' in dir(o)): print o.get_path()
get_info(o)
x = range(10)
y = [c**2 for c in x]
fig,sp = plt.subplots(1,1)
plt.plot(x,y)
get_info(fig)
出力:
Rectangle(0,0;1x1)
Path(array([[ 0., 0.],
[ 1., 0.],
[ 1., 1.],
[ 0., 1.],
[ 0., 0.]]), array([ 1, 2, 2, 2, 79], dtype=uint8))
Axes(0.125,0.1;0.775x0.8)
Line2D(_line0)
Path(array([[ 0., 0.],
[ 1., 1.],
[ 2., 4.],
[ 3., 9.],
[ 4., 16.],
[ 5., 25.],
[ 6., 36.],
[ 7., 49.],
[ 8., 64.],
[ 9., 81.]]), None)
Spine
Path(array([[ 13., 1.],
[ 13., 1.]]), None)
Spine
Path(array([[ 1., 13.],
[ 1., 13.]]), None)
Spine
Path(array([[ 13., 0.],
[ 13., 0.]]), None)
Spine
Path(array([[ 0., 13.],
[ 0., 13.]]), None)
XAxis(80.000000,48.000000)
Text(0.5,0,u'')
Text(1,0,u'')
<matplotlib.axis.XTick object at 0x104447f90>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x1045e6050>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x10720ac50>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x1072230d0>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x107223810>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x107223f50>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x10722c6d0>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x10722ce10>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x107237590>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
<matplotlib.axis.XTick object at 0x107237cd0>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 0., 1.]]), None)
Line2D((0,0),(0,1))
Path(array([[ 0., 0.],
[ 0., 1.]]), None)
Text(0,0,u'')
Text(0,1,u'')
YAxis(80.000000,48.000000)
Text(0,0.5,u'')
Text(0,0.5,u'')
<matplotlib.axis.YTick object at 0x1045c29d0>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x104447f10>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x107241990>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x107246410>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x107246910>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x107251090>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x1072517d0>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x107237f50>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x10725c310>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
<matplotlib.axis.YTick object at 0x10725ca50>
Line2D()
Path(array([[ 0., 0.]]), None)
Line2D()
Path(array([[ 1., 0.]]), None)
Line2D((0,0),(1,0))
Path(array([[ 0., 0.],
[ 1., 0.]]), None)
Text(0,0,u'')
Text(1,0,u'')
Text(0.5,1,u'')
Text(0,1,u'')
Text(1,1,u'')
Rectangle(0,0;1x1)
Path(array([[ 0., 0.],
[ 1., 0.],
[ 1., 1.],
[ 0., 1.],
[ 0., 0.]]), array([ 1, 2, 2, 2, 79], dtype=uint8))
ただし、すべてのオブジェクトが
get_path
メソッドを持っていません