Factsheet
» pip install matplotlib
python - How to install matplotlib - Stack Overflow
How to install a library (matplotlib)
Installing Matplotlib for new users - Installation - Matplotlib
How to install Matplotlib in Python 3 on Windows - Stack Overflow
Videos
Matplotlib supports python 3.x as of version 1.2, released in January, 2013.
To install it, have a look at the installation instructions. In general, call pip install matplotlib or use your preferred mechanism (conda, homebrew, windows installer, system package manager, etc). In some cases you may need to install additional non-python dependencies (libpng and freetype) through your system's package manager.
The answer below is left for historical reasons and as an example of installing the development version from github.
The current release of matplotlib doesn't support python3.
There's a github branch for python3 support for a couple of years now, but it hasn't been stable on anything other than linux until fairly recently. I believe that branch was recently merged back into the main branch.
If you want to use matplotlib on python3, you'll need to build from the current tip https://github.com/matplotlib/matplotlib
To build it, do something similar to the following:
git clone https://github.com/matplotlib/matplotlib
cd matplotlib
python3 setup.py build
sudo python3 setup.py install
If you don't have git installed, then you can just download a tarball of the current git tip instead: https://github.com/matplotlib/matplotlib/tarball/master
You'll need to have numpy installed for python3. (Installing it for python2 doesn't install it for python3.)
In most cases, that's all you'll need to do. For a default install, the only non-included python library is numpy. The other dependencies (e.g. libpng, freetype) are system libraries and if you can build matplotlib for python2, you already have them.
If you want a non-default install (e.g. if you want any of the non-default backends), then you'll need to copy the setup.cfg.default template to setup.cfg and edit it to match what you want. You'll probably only need to do this if you're planning to embed matplotlib in a gtk or qt application that you're writing, in which case you'll want the gtkagg or qtagg backends instead of just the default tkagg backend.
just to bump @endolith's comment up to answer level, from at least uBuntu 14-04 linux onwards, matplotlib support for python3 is built-in with apt:
sudo apt-get install python3-matplotlib
should install matplotlib for python3 with the necessary dependencies.
So I need to install matplotlib for a school project, and I've installed pip on my mac already. I've verified that I installed it on terminal, but now I don't know how to install or use matplotlib. I wrote "pip install matplotlib", and something seemed to be happening. At the end it said successfully installed, but if I write "import matplotlib" in pycharm it doesnt work...
The tutorial websites dont say anything, or at least I couldnt find anything
What do I do?
I'm sorry, but at the current time it's not supported.
If you feel brave, you can try with the Py3k SVN branch which reportedly works with a simple example. Be aware that there has been no update in the last 8 months on this though.
Of course, you'd be more than welcome to contribute to the porting to Python 3 if you could.
You could try the unofficial versions. Check this site:
http://www.lfd.uci.edu/~gohlke/pythonlibs/