我想在python中绘制矩阵,我的代码就像,
def myplot(data, playerlist = Players):
for name in playerlist:
plt.plot(data[Pdict[name]], label=name)
plt.legend(loc='upper left', bbox_to_anchor=(1,1))
plt.xticks(list(range(0,10)), Seasons, rotation='vertical')
plt.show()
虽然它被绘制但我得到一个错误,
IndexError Traceback(最近一次调用最后一次) in() ----> 1 myplot(FreeThrowAttempts)
<ipython-input-32-8341070ea579> in myplot(data, playerlist)
1 def myplot(data, playerlist = Players):
2 for name in playerlist:
----> 3 plt.plot(data[Pdict[name]], label=name)
4 plt.legend(loc='upper left', bbox_to_anchor=(1,1))
5 plt.xticks(list(range(0,10)), Seasons, rotation='vertical')
IndexError: index 9 is out of bounds for axis 0 with size 9
我不知道如何解决这个错误,有人可以帮我解决一下吗?