Python Matplotlib macOS backend

Matplotlib is a nice Matlab-like environment for Python. If you encounter a backend related problem while using Matplotlib [1] on a Python Virtualenv [2], then you need to explicitly select one (i.e. backend : Qt5Agg) in a ~/.config/matplotlib/matplotlibrc (or directly in a matplotlib file located in current working directory) configuration file. Then remember to use modern interpreter and meet dependencies requirements. Example below:

$ mkdir ~/.matplotlib
$ echo "backend : Qt5Agg" >> ~/.config/matplotlib/matplotlibrc
$ echo "backend : Qt5Agg" >> matplotlibrc
$ python3.6 -m venv venv-mac-36
$ source venv-mac-36/bin/activate
$ which python
$ pip install matplotlib pyqt5

Now you can use Matplotlib inside created Python Virtualenv (assuming you had Python 3.6 and Qt5 [3] already installed on your system). Other backends are: TKAgg, GTKAgg, Qt4Agg, Qt5Agg, WXAgg [4].

[1] https://matplotlib.org/
[2] https://www.python.org/
[3] https://www.qt.io/
[4] https://matplotlib.org/faq/usage_faq.html