1.5 Alternatives to Matplotlib 7
is a close working relationship between Numpy and Matplotlib and you can load
Matplotlib’s plotting functions and Numpy’s functions simultaneously using pylab
as from matplotlib.pylab import *. Although importing everything this way
as a standard practice is not recommended because of namespace pollution, there
is no danger in this case due to the close working relationship between Numpy and
Matplotlib.
One of the best ways to get started with Matplotlib is to browse the extensive
on-line “gallery” of plots on the main Matplotlib site. Each of the plots comes with
corresponding source code that you can use as a starting point for your own plots.
In Sect. 1.6, we discuss special “magic” commands that make this particularly easy.
1.5 Alternatives to Matplotlib
Even though Matplotlib is unbeatable for script-based plotting, there are some
alternatives for specialized scientific graphics that may be of interest. PyQwt is a
set of bindings for the Qwt library, which contains useful GUI components and
widgets for technical plotting. Matplotlib has some widgets for interactive plots,
but they are pretty limited. The downside of PyQwt is that it relies on the Qwt
documentation, which might be hard to read if you are not comfortable with C++
codes. Furthermore, the package does not seem to be currently maintained. The
upside is that these libraries have been around for at least a decade, so they are
well-tested and lighter-weight than Matplotlib.
Chaco is part of the Enthought Tool-Suite (ETS) and implements many real-
time data visualization concepts and corresponding widgets. It is available on
all of the major platforms and is also actively maintained and well-documented.
Chaco is geared towards GUI application development, rather than script-based data
visualization. It depends on the Traits package, which is also available in ETS and
in the Enthought Python Distribution (EPD). If you don’t want to use EPD, then
you have to build Chaco and its dependencies separately. On Linux, this should
be straight-forward, but potentially a nightmare on Windows if not for Christoph
Gohlke’s one-click installers.
If you require real-time data display and tools for volumetric data rendering and
complicated 3D meshes with isosurfaces, then PyQtGraph is an option. PyQtGraph
is a pure-Python graphics and GUI library that depends on Python bindings for the
Qt GUI library (i.e. PySide or PyQt4) and Numpy. This means that the PyQtGraph
relies on these other libraries (i.e. Qt’s GraphicsView framework) for the heavy-
duty numbercrunching and rendering. This package is actively maintained, but is
still pretty new, with good (but not comprehensive) documentation. You also need
to grasp a few Qt-GUI development concepts to use this effectively. Mayavi is
another Enthought-supported 3D visualization package that sits on VTK (open-
source C++ library for 3D visualization). Like Chaco, it is a toolkit for scientific
GUI development as opposed to script-based plotting. To use it effectively, you need