I am running Mac OSX 10.5.8. I installed matplotlib using macports. I get some examples from the matplotlib gallery like this one, without modification:
http://matpl
Mac comes with its own python (read from here, which is not the best), I would suggest just a clean install of some Python 3.7 or so along with Anaconda and then introduce them as interpreters to PyCharm. anything will work fine and you wont need to add ad-hoc solutions like "backend: MacOSX" or so.
After the plot simply add -
plt.show()
The reason this works is to do with interactive vs non-interactive mode. If the backend is opened in non-interactive mode, plt.show()
is required at the end of the code chunk. You can check the status by calling plt.isinteractive()
and toggle the status using plt.ion()
and plt.ioff()
I wanna share this workable solution for me,
import matplotlib
import platform
if platform.system() == 'Darwin':
matplotlib.use('MacOSX')
This is what worked for me:
brew install pkg-config
brew link pkg-config
brew install pygtk
brew install freetype
brew install libpng
sudo ln -s /usr/local/Cellar/freetype/*/lib/pkgconfig/freetype2.pc /usr/local/lib/pkgconfig/freetype2.pc
git clone git@github.com:matplotlib/matplotlib.git
cd matplotlib
python setup.py build
python setup.py install
References:
http://blog.caoyuan.me/2012/08/matplotlib-error-mac-os-x/ http://matplotlib.org/faq/installing_faq.html#install-from-git http://www.tapir.caltech.edu/~dtsang/python.html
I had the same problem, even I could see how a new application window was created and immediately disappeared.
Simple solution - just check if you have
plt.show()
after the plot
just to add a note,
The matplotlibrc file was not present on my system and I had to to download a copy from the matplotlib website. Future users may have to do the same.