如何在pyplot中显示情节

时间:2014-04-07 09:37:37

标签: python python-2.7 matplotlib

我收到此代码的以下错误,我该如何解决:

from numpy import *
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

mpl.rcParams['legend.fontsize'] = 15
fig = plt.figure ()
ax = fig.gca(projection='3d')

t =  linspace (-2, 2, 100)
x = (1 + t**2) * sin(2 * pi * t)
y = (1 + t**2) * cos(2 * pi * t)
z = t

ax.plot(x, y, z, label='Parametric 3D curve')
ax.legend()
show()

错误:

  

Traceback(最近一次调用最后一次):文件   " / home / me / workspace / mysecondpythontest / my1pythontest",第19行,in     show()NameError:name' show'未定义

1 个答案:

答案 0 :(得分:2)

show()不存在。

您需要致电plt.show()