且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

动画 Matplotlib 面板 - blit 留下旧帧

更新时间:2023-11-30 16:00:58

已根据请求添加为答案 :)

Added as an answer, by request :)

在调用 fig.canvas.copy_from_bbox 之前尝试调用 fig.canvas.draw().确切的行为取决于后端,因此在不同平台上会有所不同,但一般来说,您需要先绘制画布,然后再尝试从中复制内容.

Try calling fig.canvas.draw() before calling fig.canvas.copy_from_bbox. The exact behavior depends on the backend, so it will be different on different platforms, but generally speaking you need to draw the canvas before trying to copy things from it.