擅长:python、mysql、java
<p>问题是,最初用单一颜色(1.0)定义绘图,因此颜色范围设置为该值。当你更新图形时,颜色范围是1.0+——一些小值,所以你看不到变化。您需要使用<code>vmin</code>/<code>vmax</code>参数将颜色范围设置为1到0之间,如下所示:</p>
<pre><code>im = plt.imshow(viewport, animated=True, vmin=0., vmax=1.)
</code></pre>
<p>代码的其余部分保持不变,这应该可以按预期工作。另一种选择是增加通话</p>
^{pr2}$
<p>在<code>im.set_array(viewpoint)</code>之后强制每次更新颜色范围。在</p>