Recently run on jupyter notebook running the code, we found that the use of matplotlib.show () image is not displayed on the Internet looking for a bit solution, first on the reference link:
The reason : matplotlib displayed depending on the configuration of the backend, when it is agg, the system does not display pictures
Solutions are as follows :
1. Check the backend method matplotlib of:
1 import matplotlib 2 matplotlib.get_backend() 3 # 或者 4 # matplotlib.pyplot.get_backend()
2. If the display is "agg", you need to install Tkinter, set Agg method, common are: Qt4Agg Qt5Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG have
. 1 Import matplotlib 2 Print matplotlib.matplotlib_fname () . 3 # Display file location matplotlibrc 4 # modify matplotlibrc following code file . 5 backend: youragg