TypeError例外:Pythonでサブプロットにしようとしたときに「タプル」オブジェクトが呼び出し可能ではありません

Lheal:

現在、Pythonでいくつかのサブプロットを作成しようとしています。この正確なコードは昨日働いた、そして今、私は「例外TypeError: 『タプル』オブジェクトが呼び出すことはできません」を取得しています

奇妙なことは、それは私がコマンドバーで別々にすべてのこれらのグラフを実行できますが、私は完全なコードを実行すると、それだけで私は、このエラーを与える前に、それらのうちの2つをプロットします。私は再びプロットするか、私はプロットにしてみてください何かが私にその答えを与える開始するためにカーネルを再起動する必要があります。

ここで私はコードにしようとしているものです。

plt.subplot(2,2,1)
plt.plot(x_axis, avg_ANK_ang[:,0], color='red', linewidth=1, linestyle = '--')
plt.fill_between(x_axis, avg_ANK_ang[:,0]-angANKnvf_err, avg_ANK_ang[:,0]+angANKnvf_err, alpha=0.5,  facecolor='#FF9848')
plt.plot(x_axis, avg_ANK_ang[:,1], color='blue', linewidth=1)
plt.fill_between(x_axis, avg_ANK_ang[:,1]-angANKcvf_err, avg_ANK_ang[:,1]+angANKcvf_err, alpha=0.5,  facecolor='#089FFF')
plt.xticks([])
seaborn.despine(left=True, bottom=True, right=True)
plt.ylabel("Ankle")
plt.title("Angle (deg)")

plt.subplot(2,2,3)
plt.plot(x_axis, avg_MTP_ang[:,0], color='red', linewidth=1, linestyle = '--')
plt.fill_between(x_axis, avg_MTP_ang[:,0]-angMTPnvf_err, avg_MTP_ang[:,0]+angMTPnvf_err, alpha=0.5,  facecolor='#FF9848')
plt.plot(x_axis, avg_MTP_ang[:,1], color='blue', linewidth=1)
plt.fill_between(x_axis, avg_MTP_ang[:,1]-angMTPcvf_err, avg_MTP_ang[:,1]+angMTPcvf_err, alpha=0.5,  facecolor='#089FFF')               
seaborn.despine(left=True, bottom=True, right=True) 
plt.plot = (x_axis, 0)             
plt.ylabel("MTP") 
plt.xlabel("% stance")

plt.subplot(2,2,2)
plt.plot(x_axis, avg_ANK_mom[:,0], color='red', linewidth=1, linestyle = '--')
plt.fill_between(x_axis, avg_ANK_mom[:,0]-momANKnvf_err, avg_ANK_mom[:,0]+momANKnvf_err, alpha=0.5,  facecolor='#FF9848')
plt.plot(x_axis, avg_ANK_mom[:,1], color='blue', linewidth=1)
plt.fill_between(x_axis, avg_ANK_mom[:,1]-momANKcvf_err, avg_ANK_mom[:,1]+momANKcvf_err, alpha=0.5,  facecolor='#089FFF')             
plt.xticks([])
seaborn.despine(left=True, bottom=True, right=True)
plt.title("Moment (NM)")  

plt.subplot(2,2,4)
plt.plot(x_axis, avg_MTP_mom[:,0], color='red', linewidth=1, linestyle = '--')
plt.fill_between(x_axis, avg_MTP_mom[:,0]-momMTPnvf_err, avg_MTP_mom[:,0]+momMTPnvf_err, alpha=0.5,  facecolor='#FF9848')
plt.plot(x_axis, avg_MTP_mom[:,1], color='blue', linewidth=1)
plt.fill_between(x_axis, avg_MTP_mom[:,1]-momMTPcvf_err, avg_MTP_mom[:,1]+momMTPcvf_err, alpha=0.5,  facecolor='#089FFF')             
seaborn.despine(left=True, bottom=True, right=True)
plt.xlabel("% stance")

エラー:


  File "/Users/Laura/Box/NVF/Biomechanics data/Compile/compile.py", line 130, in <module>
    plt.plot(x_axis, avg_ANK_mom[:,0], color='red', linewidth=1, linestyle = '--')

TypeError: 'tuple' object is not callable

他の奇妙なことは、それは一般的にエラーを与える前に最初の二つのグラフをプロットしています。(私は個別にコマンドウィンドウに入れていない限り、最初の3つは一般的にプロットされます)

ジョン・ゴードン:
plt.plot = (x_axis, 0)

コード行が問題です。あなたは、再割り当てしましplt.plotタプル変数であるためには、それはもう機能しません。

おすすめ

転載: http://10.200.1.11:23101/article/api/json?id=383936&siteId=1