in[]:x=linspace(0,2*pi,50)
in[]:plot(x,sin(x))
Traceback (most recent call last):
File "<ipython-input-55-3271d4c7a0b1>", line 1, in <module>
plot(x,tan(x))
TypeError: only size-1 arrays can be converted to Python scalars
答案 0 :(得分:0)
使用numpy库这应该有用
import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,2*np.pi,50)
plt.plot(x,np.sin(x))