As mentioned earlier, Matplotlib has its origin in scientific fields, so it is commonly used to plot huge datasets. Python's native support for long lists becomes impractical for such sizes, so Matplotlib needs better support for arrays.
NumPy, the de facto standard Python module for numerical elaborations, provides support for high performance operations even with big mathematical data types such as arrays or matrices—along with many other mathematical functions that can be useful to Matplotlib users.
NumPy has to be available to use Matplotlib.
Once we have chosen the set of user interfaces (UIs) we prefer, then we need to install the Python bindings for them. Here is a summarizing list:
User Interface (UI) |
Binding |
Version |
Description |
---|---|---|---|
FLTK |
pyFLTK |
1.0 or higher |
pyFLTK provides Python wrappers for the FLTK widgets library for use with |
GTK+ |
PyGTK |
2.2 or higher |
PyGTK provides Python wrappers for the GTK+ widgets library to use it with the It is recommended to use a version higher than 2.12, for a correct memory management. |
Qt |
PyQt or PyQt4 |
3.1 or higher and for Qt4, 4.0 or higher |
PyQt or PyQt4 provides Python wrappers for the Qt toolkit and is required by the Matplotlib |
Tk |
PyTK |
8.3 or higher |
Python wrapper for Tcl or Tk widgets library is used in |
Wx |
wxPython |
2.6 or higher, or 2.8 or higher |
wxPython provides Python wrappers for the wxWidgets library for use with the |
Another important tool, in particular for interactive usage, is IPython. It's an interactive Python shell with a lot of useful features, such as history, commands repeating, and others. It already has a Matplotlib mode in it. We'll be using IPython in this book, so it is recommended to install it.
Some of the tools that are needed by Matplotlib are already shipped with it (in the source code as well as in the binary distributions). Here is the list of those tools:
AGG (version 2.4): This is the Anti-Grain Geometry rendering engine. The local copy of the library is linked with the Matplotlib code in a static way. So, there's no need to install it (as a shared library).
pytz (version 2007g or higher): This is used for handling the time zone for
datetime
Python objects. It will be installed if it's not already present in the system. It can be overridden usingsetup.cfg
.python-dateutil (version1.1 or higher): This is used for enhanced handling of the
datetime
Python objects. It needs to be installed if it's not already present in the system and can be overridden usingsetup.cfg.
The following tools are needed if we're going to install Matplotlib from the source:
Python: Currently, only Python 2.x is supported (no Python 3 yet)
NumPy: Version 1.1 or higher
libpng: Version 1.1 or higher is needed to load or save PNG images (Windows users can skip this requirement)
FreeType: Version 1.4 or higher is needed for reading TrueType font files (Windows users can skip this requirement)