如何在 Python 中设置 matplotlib 中的"后端"?
pythonmatplotlibserver side programmingprogramming更新于 2024/9/19 2:20:17
我们可以使用 matplotlib.rcParams['backend'] 来覆盖后端值。
步骤
使用 get_backend() 方法,返回当前后端的名称,即默认名称。
现在覆盖后端名称。
使用 get_backend() 方法,返回当前后端的名称,即更新后的名称。
示例
import matplotlib
print("之前,matplotlib 使用的后端是:", matplotlib.get_backend())
matplotlib.rcParams['backend'] = 'TkAgg'
print("之后,matplotlib 使用的后端是:", matplotlib.get_backend())
输出
之前,matplotlib 使用的后端是:GTK3Agg 之后,matplotlib 使用的后端是:TkAgg
相关文章
有用资源
python 参考教程 - 该教程包含有关 python 的更多信息:https://www.cainiaomax.com/python/

