【发布时间】:2018-11-22 16:49:23
【问题描述】:
为 Python matlabplot parametric example 设置动画的 SIMPLIST 方法是什么?
我想逐项更新循环中的数据。可悲的是,这看起来很糟糕,并且总是闪烁着彩虹的每一种颜色! 有没有一种简单的方法可以让我在计算数据时更新数据?
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
import numpy as np
import matplotlib.pyplot as plt
import math
plt.rcParams['legend.fontsize'] = 10
fig = plt.figure()
ax = fig.gca(projection='3d')
i = 10
theta = 0
x=[]
y=[]
z=[]
# Prepare arrays x, y, z
while (theta < 4*np.pi):
theta += 0.05
z += [i]
r = i**2 + 1
x += [r * math.sin(theta)]
y += [r * math.cos(theta)]
i +=1
ax.plot(x, y, z)
plt.pause(0.01)
【问题讨论】:
-
你看this example了吗?
标签: python animation matplotlib curve