matplotlib之__main__:1: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.

如果遇到问题:

__main__:1: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.

解决方案:

在程序中增加一条语句:

import matplotlib

matplotlib.use('TkAgg') (增加这条语句)

原文地址:https://www.cnblogs.com/elitphil/p/12221345.html