UserWarning:Matplotlib当前正在使用agg,这是一个非GUI后端,因此无法显示该图

时间:2019-09-05 06:33:41

标签: python python-3.x python-2.7

UserWarning:Matplotlib当前正在使用agg,它是非GUI后端,因此无法显示该图。

UserWarning:Matplotlib当前正在使用agg,它是非GUI后端,因此无法显示该图。

解决方法

1 个答案:

答案 0 :(得分:0)

如果要使用plt.show(),则需要设置其他后端。 Agg后端只能将绘图写入文件,而不能显示交互式输出。 您可以通过在matplotlibrc文件(https://matplotlib.org/users/customizing.html#the-matplotlibrc-file)中设置backend字段来全局设置后端。

您还可以在程序中设置后端。只需看看上面链接的页面即可。

相关问题