Mat*_*kin 85 python matplotlib
交互式,例如在Ipython会话中,或在脚本中,如何确定matplotlib正在使用哪个后端?
And*_*rew 107
使用该get_backend()
函数获取表示正在使用哪个后端的字符串:
>>> import matplotlib
>>> matplotlib.get_backend()
'TkAgg'
Run Code Online (Sandbox Code Playgroud)
确定当前后端的另一种方法是读取rcParams
字典:
>>> import matplotlib
>>> print (matplotlib.rcParams['backend'])
MacOSX
>>> matplotlib.use('agg')
>>> print (matplotlib.rcParams['backend'])
agg
Run Code Online (Sandbox Code Playgroud)