Girish Mahajan (Editor)

Matplotlib

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Original author(s)
  
John D. Hunter

Written in
  
Python

Matplotlib

Developer(s)
  
Michael Droettboom, et al.

Initial release
  
2003; 14 years ago (2003)

Stable release
  
2.0.0 (17 January 2017; 57 days ago (2017-01-17)) [±]

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 using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK+. There is also a procedural "pylab" interface based on a state machine (like OpenGL), designed to closely resemble that of MATLAB, though its use is discouraged. SciPy makes use of matplotlib.

Contents

matplotlib was originally written by John D. Hunter, has an active development community, and is distributed under a BSD-style license. Michael Droettboom was nominated as matplotlib's lead developer shortly before John Hunter's death in 2012.

As of 30 October 2015, matplotlib 1.5.x supports Python versions 2.7 through 3.5. Matplotlib 1.2 is the first version of matplotlib to support Python 3.x. Matplotlib 1.4 is the last version of matplotlib to support Python 2.6.

Comparison with MATLAB

pyplot is a matplotlib module which provides a MATLAB-like interface. matplotlib is designed to be as usable as MATLAB, with the ability to use Python, with the advantage that it is free.

Comparison with Gnuplot

Both gnuplot and matplotlib are mature open-source projects. They both can produce many types of different plots. While it is hard to specify a type of figure that one can do and the other can not, they still have different advantages and disadvantages:

Examples

Line plot

Histogram

Scatter plot

3D plot

More examples

Toolkits

Several toolkits are available which extend matplotlib functionality. Some are separate downloads, others ship with the matplotlib source code but have external dependencies.

  • Basemap: map plotting with various map projections, coastlines, and political boundaries
  • Cartopy: a mapping library featuring object-oriented map projection definitions, and arbitrary point, line, polygon and image transformation capabilities. (matplotlib v1.2 and above)
  • Excel tools: utilities for exchanging data with Microsoft Excel
  • GTK tools: interface to the GTK+ library
  • Qt interface
  • Mplot3d: 3-D plots
  • Natgrid: interface to the natgrid library for gridding irregularly spaced data.
  • matplotlib2tikz: export to Pgfplots for smooth integration into LaTeX documents
  • Biggles
  • Chaco
  • DISLIN
  • GNU Octave
  • Gnuplot-py
  • PLplot – Python bindings available
  • PyCha – libcairo implementation
  • PyPlotter – compatible with Jython
  • Pyx
  • ReportLab
  • SageMath – uses matplotlib to draw plots
  • SciPy (modules plt and gplt)
  • wxPython (module wx.lib.plot.py)
  • Plotly – for interactive, online matplotlib and Python graphs
  • References

    Matplotlib Wikipedia