matplotlib使用常见错误与解决方法

matplotlib使用常见错误与解决方法

1.正确导入matplotlib和pyplot后提示:AttributeError: module ‘matplotlib’ has no attribute ‘verbose’这样的error。
解决方发:在import matplotlib as mpl后调用mpl.use(‘Agg’),调用后就可以解决。
2. matplotlib使用正常后,编译只输出数据并无显示的问题
解决方法:mpl.use(‘TkAgg’)设置成这样。即可显示如下图
matplotlib使用常见错误与解决方法
设置成:mpl.use(‘Qt5Agg’)显示界面如下
matplotlib使用常见错误与解决方法
问题持续跟新