血小板()最近改变了行为

2024-04-20 01:39:39 发布

您现在位置:Python中文网/ 问答频道 /正文

下面的python脚本不再像以前在我的机器上那样显示图形:

import matplotlib.pyplot as plt

plt.scatter(1, 1)
plt.show() # Blocks and opens a graphical window as usual.

plt.ion()
plt.scatter(1, 1) # Does *not* open a graphical window anymore as I expect.
plt.scatter(2, 2) # Does *not* update the graphical window anymore as I expect (there is still no window at all)

plt.ioff()
plt.show() # The window opens at last, but it's blocking.

我还注意到图形窗口样式已更改(底部栏):

matplotlib new style

我猜是因为我的Arch系统最近升级到matplotlib3.0.3-1。但是我在他们的What's New页面上看不到ion()的重大变化。你知道吗

是什么原因造成的?
如何获得一个非阻塞图,就像我以前在两个ion()ioff()调用之间获得的一样?你知道吗


[UPDATE]我可以确认降级到matplotlib2.2.3-2确实会恢复到预期的行为。因此,问题似乎在于matplotlib或其环境的最新升级。你知道吗

[UDPATE]在matplotlibissue tracker上存档。你知道吗


Tags: 图形matplotlibasshownotpltwindowat