I installed Python 3.6 and matplotlib (along with numpy, scipy, etc) through MacPorts on my iMac G4 but importing matplotlib.pyplot crashes python:
192:~ Raul$ python3
Python 3.6.5 (default, Mar 29 2018, 15:41:19)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits"...