MatPlotLib

THIS PAGE IS UNDER DEVELOPMENT

Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications.

Good quality graphic rendering Immediate export to PNG, PDF, etc. Rich documentation and many examples Strong community

pyplot is a module in matplotlib which provides a MATLAB-like interface pylab is a module that gets installed alongside matplotlib and also provides a MATLAB-like interface pylab is a convenience module that bulk imports matplotlib.pyplot (for plotting) and numpy (for mathematics and working with arrays) in a single name space. pylab is no longer recommanded.

High level library: ideal for interactive computing

How to process

We can look for a type of figure and get the source code from: http://matplotlib.sourceforge.net/gallery.html

Input types

The figure object

The subplot function

How to animate

meshgrid/contourf

mplot 3D

Backends

matplotlib can be used: * into graphical user interfaces like wxpython or pygtk to build rich applications. * in batch scripts to generate postscript images from some numerical simulations * in web application servers to dynamically serve up graphs.

Each of these alternatives is called a backend

There are two types of backends: * user interface backends (for use in pygtk, wxpython, tkinter, qt4, or macosx; also referred to as “interactive backends”) * hardcopy backends to make image files (PNG, SVG, PDF, PS; also referred to as “non-interactive backends”).

User interface backends

PyGTK: Based on the C library GTK Clear and complete documentation, dedicated editor = Glade. Fully capitalise on Python capabilities. PyGTK applications are multiplatform.

WxPython: a blending of the wxWidgets C++ class library with the Python programming language. WxPython is a cross-platform toolkit.

Tkinter: python implementation of Tcl / Tk. Simplicity (limited choice of widgets) Availability (built within the standard library) Simple appearance

PyQt: Based on the C ++ Qt library Usable from Eclipse and Nokia Tools (QtCreator). Modern appearance Copy of the C ++ library