【发布时间】:2020-05-09 10:24:37
【问题描述】:
以下代码产生错误:
x = np.arange(100)
fig = plt.subplots()
plt.plot(x)
plt.show()
fig.show()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-528-6ebedab27258> in <module>
----> 1 fig.show()
AttributeError: 'tuple' object has no attribute 'show'
导致错误的原因以及我应该如何更正我的代码?
【问题讨论】:
-
在错误
fig.show()中是错误的行并且在代码中没有这样的行?究竟是什么错误? -
我想绘制调用 fig.show() 的图形。而不是产生情节,我得到一个错误。
标签: python python-3.x matplotlib