matplotlib.pyplot.switch_backend#

matplotlib.pyplot.switch_backend(newbackend)[源]#

设置 pyplot 后端。

只有在没有其他交互式后端事件循环启动的情况下,才能切换到交互式后端。在交互式后端和非交互式后端之间切换始终是可能的。

如果新后端与当前后端不同,则所有打开的 Figure 将通过 plt.close('all') 关闭。

参数:
newbackendstr

要使用的后端名称,不区分大小写。