Matplotlib For Mac Os X

The following instructions are based on a blog post with some tweaks to install the patched pip packages in the default path rather than leaving them in a local source folder.

Anyhow, I switched to wx, and have never been happier. It looks great on Aqua, is totally cross-platform, and XRCed rocks! TkAgg with Aqua-based Tkinter works for me on Mac OS X. (That's with matplotlib 0.54 - I haven't tried the latest CVS with fixes for dynamic updates, but am. I've upgraded to matplotlib 1.4.0 and am getting invalid EPS files (according to Preview) when I save figures that use basemap (1.0.7). The same figure in PNG or PDF format works fine. I also saved a bar chart in EPS that worked.

The following set of instructions is provided with some annotations. However, the code in each step can (and should!) just be pasted into the terminal window (except for the first part, which belongs in .bashrc).

Successfully tested with

  • Python 2.7.2
  • NumPy 1.6.1
  • SciPy 0.11.0.dev-b924f0b
  • matplotlib 1.2.x

Note that this installation may fail for other versions if they change how modules are treated in SciPy or matplotlib; furthermore, the Python version is hard-coded below.

Oh and by the way, this can take quite a while (compiling gfortran from source etc.) so grab a cup of coffee.

Edit $PATH manually in .bashrc:

Just add the following lines at a convenient location to the file ~/.bashrc:

Install Homebrew

Homebrew is a package manager for Mac that is superior in usage to MacPorts and Fink. However, it can occasionally run into trouble if it is installed side by side with either of those. It's therefore advised to have only Homebrew installed.

(The following command(s) may ask for super user rights.)

Install prerequisites

Install & set up Python itself

Sony sound forge for mac os x. This step installs Python 2.7 and makes it the system’s default Python version. This does not uninstall the pre-installed Python, it just deactivates it.

Install pip

pip is an easy package manager for Python that acts as a replacement for easy_install. Ironically, it’s installed using the latter.

Matplotlib Mac Os X

Install NumPy, SciPy & matplotlib

For the following operations, we first of all alias pip to its explicit path just in case one of the previous steps went wrong (this happened, and I’m not exactly sure where, or how to prevent it).

Next, use it to install all the rest.

Matplotlib mac os x framework

Let the cleanup begin …

The previous installations leave behind the sources, and were not properly staged into the Python path; instead, they are lying around in the user’s home folder.The following steps move them to their appropriate location and make sure Python finds them correctly.They also remove the now-redundant source files.

SciPy

matplotlib

Clean up easy-install paths

To check that everything worked:

This should display /usr/local/bin/python as the binary’s path, and 2.7.2 as the version. Then type the following while still in the Python interactive console:

Working With Matplotlib On Osx

In each case, the path should be somewhere in /usr/local/Cellar/python.

Matplotlib For Mac Os X 10.10

Finally, you can also remove the folder ~/src if you don’t need it for other purposes.