小编Rob*_*Tan的帖子

表面动画并使用 matplotlib 保存

我尝试做一个非常简单的动画并用 matplotlib 保存它,但没有成功。例如,我想看到一些振荡的东西:这是我能做的最好的事情

import numpy as np
import matplotlib.pyplot as plt    
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.animation as animation

#Define x,y vectors and meshgrid with function u on it

x = np.arange(0,10,0.1)
y = np.arange(0,10,0.1)
X,Y = np.meshgrid(x,y)
u = np.sin(X + Y)

#Create a figure and an axis object for the surface
#(which by the way is not initialized, because I don't know were to)

fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')

#Define a kind-of animation function, imitating what I …
Run Code Online (Sandbox Code Playgroud)

python math animation matplotlib matplotlib-animation

3
推荐指数
2
解决办法
1853
查看次数