【发布时间】:2013-10-28 18:10:05
【问题描述】:
我在 OS X 上使用 Encopy(由 Enthought Inc. 提供)来编写我的 Python 程序。我从here 获取的以下代码仅生成一个点然后终止:
from pylab import *
import time
t = linspace(0.0, pi, 100)
x = cos(t)
y = sin(t)
ion() # turn on interactive mode
figure(0)
subplot(111, autoscale_on=False, xlim=(-1.2, 1.2), ylim=(-.2, 1.2))
point = plot([x[0]], [y[0]], marker='o', mfc='r', ms=3)
for j in arange(len(t)):
# reset x/y-data of point
setp(point[0], data=(x[j], y[j]))
time.sleep(0.05)
draw() # redraw current figure
ioff() # turn off interactive mode
show()
任何想法可能是什么问题? 下面是我得到的结果的照片。
【问题讨论】:
-
使用
plt.pause而不是sleep -
@tcaswell,谢谢。但仍然是一个点!
标签: python matplotlib enthought