Could not find or load the Qt platform plugin “xcb”

To fix this problem, I added to the top:

import matplotlib
matplotlib.use('Agg')

I have a CentOS7, Anaconda3-4.5.0, python3.5
pyqt version 5.6.0 and qt version 5.6.0

If you want to use the plot in a Tkinter window for visualisation then use:

matplotlib.use('TkAgg')

Leave a Comment