相关疑难解决方法(0)

使用matplotlib.animate在python中为等高线图设置动画

我有一个3D数据阵列(2个空间维度和1个时间维度),我正在尝试使用matplotlib.animate生成动画轮廓图.我使用此链接作为基础:

http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/

这是我的尝试:

import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
from numpy import array, zeros, linspace, meshgrid
from boutdata import collect

# First collect data from files
n = collect("n")   #  This is a routine to collect data
Nx = n.shape[1]
Nz = n.shape[2]
Ny = n.shape[3]
Nt = n.shape[0]

fig = plt.figure()
ax = plt.axes(xlim=(0, 200), ylim=(0, 100))
cont, = ax.contourf([], [], [], 500)

# initialisation function
def init():
    cont.set_data([],[],[])
    return cont, …
Run Code Online (Sandbox Code Playgroud)

python matplotlib contour

19
推荐指数
3
解决办法
1万
查看次数

标签 统计

contour ×1

matplotlib ×1

python ×1