How to draw an unit circle using numpy and matplotlib -
i want draw unit circle(cos+sin), using numpy , matplotlib. wrote following:
t = np.linspace(0,np.pi*2,100) circ = np.concatenate((np.cos(t),np.sin(t)))
and plotted, failed.
ax.plot(t,circ,linewidth=1) valueerror: x , y must have same first dimension
plot
not parametric plot. must give x
, y
values, not t
.
x
cos(t)
, y
sin(t)
, give arrays plot
:
ax.plot(np.cos(t), np.sin(t), linewidth=1)
Comments
Post a Comment