问题记录:'AxesSubplot' object does not support indexing

绘制单行或者单列的图表时,不支持索引

例:

fig, ax = plt.subplots(3, 1)
ax[0][0].plot(list,)
ax[1][0].plot(list,)
...
TypeError: 'AxesSubplot' object does not support indexing

正确索引方法:

fig, ax = plt.subplots(3, 1)
ax[0].plot(list,)
ax[1].plot(list,)
...

结论:matplotlib 图表排列时,不支持在行或者列为1的位置索引

posted @ 2022-03-31 10:35  小艾衰  阅读(385)  评论(0编辑  收藏  举报