0
import numpy as np
import matplotlib.pyplot as plt
li = [[0,0],[20,10], [30,40] ]
xs = [x[0] for x in li]
ys = [x[1] for x in li]
aa = [0, 10, 40]
bb = [0, 10, 40]
fig = plt.figure(figsize=(12,4))
print "type(fig) : " , type(fig)
ax = fig.add_subplot(1,1,1)
print "type(ax) : " , type(ax)
print "ax : " , ax
ax.plot(xs, ys, '--', linewidth=2, color='red')
ax.plot(ys, xs)
ax.plot(aa, bb)
plt.legend(('PID_1', 'PID_2'), loc='best', shadow=True, fancybox=True, ncol=2)
plt.show()
gca = fig.gca() #could have used plt.gca() also
print "fig : " , fig , ", type(fig) : " , type(fig), ", id(fig) : " , id(fig)
figObj = gca.get_figure()
print "figObj : " , figObj , ", type(figObj) : " , type(figObj) , ", id(figObj) : " , id(figObj)
currGcf = plt.gcf()
print "currGcf : " , currGcf , ", type(currGcf) : " , type(currGcf), ", id(currGcF) : " , id(currGcf)
fig : Figure(960x320) , type(fig) : <class 'matplotlib.figure.Figure'> , id(fig) : 172216392
figObj : Figure(960x320) , type(figObj) : <class 'matplotlib.figure.Figure'> , id(figObj) : 172216392
currGcf : Figure(480x320) , type(currGcf) : <class 'matplotlib.figure.Figure'> , id(currGcF) : 213232048
<matplotlib.figure.Figure at 0xcb5a9b0>
が、私はこのケースでは、GCFを取得、現在の数字を与えていると考え...だから、最初の2つの出力は同じidを与えますそして予想されるサイズ。
しかし、サイズとIDの最後のgcf出力は異なります.. なぜこの違いがありますか?
おかげ@tom ...、スクリプトの最後に
plt.show()
を移動した場合 –