Python中文
首页
教程
问答
标签
搜索
登录
注册
(python)matplotlib动画不sh
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我基于<code>matplotlib</code>站点<a href="http://matplotlib.org/examples/animation/dynamic_image.html" rel="nofollow noreferrer">example</a>编写了以下代码。在</p> <pre><code>import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation fig = plt.figure() nFreqs = 1024 nFFTWindows = 512 viewport = np.ones((nFreqs, nFFTWindows)) im = plt.imshow(viewport, animated=True) def updatefig(*args): global viewport print viewport viewport = np.roll(viewport, -1, axis=1) viewport[:, -1] = 0 im.set_array(viewport) return im, ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True) plt.show() </code></pre> <p>在改变动画作品之前,但现在没有了。我希望它从紫色开始,从右边到左边慢慢变黄。<code>viewport</code>变量没有正确更新(在我的函数中用<code>print</code>检查它)。在</p> <p>我得到了静态图像(所有图像,就像最初一样):</p> <p><a href="https://i.stack.imgur.com/0uVq8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0uVq8.png" alt="enter image description here"/></a></p> <p>我哪里出错了?在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>“首选项”>;“IPython控制台”>;“图形”>;“后端”,并将其从“内联”更改为“自动”</p> <p>在应用上述更改后,不要忘记重新启动IDE(Spyder、PyCharm等)。在</p> <p>干杯</p> <p>:)</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
尽管Python中的所有内容都是引用,为什么Python导师在没有指针的列表中绘制字符串和整数?
6 回答
尽管python中的表达式为false,但循环仍在运行
10 回答
尽管python代码正确,但从nifi ExecuteScript处理器获取语法错误
6 回答
尽管Python在Neovim中工作得很好,但插件不能识别Neovim中的Python主机
9 回答
尽管python字典包含了大量的条目,但它并没有增长
7 回答
尽管python说模块存在,为什么我会得到这个消息?
8 回答
尽管setuptools和控制盘是最新的,但无法识别singleversionexternallymanaged
4 回答
尽管stdout和stderr重定向,但未捕获错误消息
5 回答
尽管Tensorboard的事件太大,但Tensorboard的步骤太少了
6 回答
尽管tkinter上的变量已更改,但显示未更改
7 回答
尽管try/except使用Python进行单元测试时出现断言错误
5 回答
尽管URL是sam,但仍会抛出“达到最大重定向”
9 回答
尽管url有效,Pandas仍读取url的\u csv错误
9 回答
尽管while中存在时间延迟,但LINUX线程的CPU利用率为100%(1)
5 回答
尽管x0在范围内,Scipy优化仍会引发ValueError
8 回答
尽管xpath正确,但使用selenium单击链接仍不起作用
8 回答
尽管下载了ffmpeg并设置了路径变量python,但没有后端错误
3 回答
尽管下载了i,但找不到型号“fr”
2 回答
尽管下载了plotnine包,但未获取名为“plotnine”的模块时出错
8 回答
尽管为所有行指定了权重,网格(0)仍不起作用
7 回答