小编Mel*_*ict的帖子

使用matplotlib从pcolormesh动画化Quadmesh

由于一整天的反复试验,我将调查结果发布给任何可能遇到此问题的人.

在过去的几天里,我一直在尝试模拟netCDF文件中某些雷达数据的实时绘图,以便与我正在为学校项目构建的GUI一起工作.我尝试的第一件事是使用matplotlib的"交互模式"简单地重绘数据,如下所示:

import matplotlib.pylab as plt

fig = plt.figure()
plt.ion() #Interactive mode on
for i in range(2,155): #Set to the number of rows in your quadmesh, start at 2 for overlap
    plt.hold(True)
    print i
    #Please note: To use this example you must compute X, Y, and C previously.
    #Here I take a slice of the data I'm plotting - if this were a real-time
    #plot, you would insert the new data to be plotted here.
    temp = plt.pcolormesh(X[i-2:i], Y[i-2:i], C[i-2:i]) …
Run Code Online (Sandbox Code Playgroud)

python animation matplotlib

6
推荐指数
1
解决办法
2252
查看次数

标签 统计

animation ×1

matplotlib ×1

python ×1