Matplotlib is a
plotting library
A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vi ...
for the
Python programming language and its numerical mathematics extension
NumPy. It provides an
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
API for embedding plots into applications using general-purpose
GUI toolkits like
Tkinter,
wxPython,
Qt, or
GTK. There is also a
procedural
Procedural may refer to:
* Procedural generation, a term used in computer graphics applications
*Procedural knowledge, the knowledge exercised in the performance of some task
* Procedural law, a legal concept
*Procedural memory, a cognitive scienc ...
"pylab" interface based on a
state machine (like
OpenGL
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
), designed to closely resemble that of
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementa ...
, though its use is discouraged.
SciPy makes use of Matplotlib.
Matplotlib was originally written by
John D. Hunter
John D. Hunter (August 1, 1968 – August 28, 2012) was an American neurobiologist and the original author of Matplotlib.Hunter, John D. "Matplotlib: A 2D graphics environment." Computing in science and engineering 9.3 (2007): 90-95.
Biography
He ...
. Since then it has had 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 August 2012 and was further joined by Thomas Caswell. Matplotlib is a
NumFOCUS fiscally sponsored project.
Matplotlib 2.0.x supports Python versions 2.7 through 3.10. Python 3 support started with Matplotlib 1.2. Matplotlib 1.4 is the last version to support Python 2.6. Matplotlib has pledged not to support Python 2 past 2020 by signing the Python 3 Statement.
Comparison with MATLAB
Pyplot is a Matplotlib module that provides a MATLAB-like interface. Matplotlib is designed to be as usable as MATLAB, with the ability to use Python, and the advantage of being free and open-source.
Examples
File:Synchrotron Functions.svg, Line plot
File:Matplotlib histogram v.svg, Histogram
File:Matplotlib scatter v.svg, Scatter plot
File:Matplotlib 3d v.svg, 3D plot
File:Mpl example qbo.svg, Image plot
File:Mpl example Helmoltz coils.svg, Contour plot
File:Weight Growth of RN First Rate Line-of-Battle Ships 1630-1875.svg, Scatter plot
File:Logarithmic Spiral Pylab.svg, Polar plot
File:Temp-sunspot-co2.svg, Line plot
File:Mpl example Rosenbrock function.svg, 3-D plot
File:Mandelbrot set, plotted with Matplotlib.svg, Image plot
Toolkits
Several toolkits are available which extend Matplotlib functionality. Some are separate downloads, others ship with the Matplotlib
source code
In computing, source code, or simply code, is any collection of code, with or without comment (computer programming), comments, written using a human-readable programming language, usually as plain text. The source code of a Computer program, p ...
but have external dependencies.
*Basemap: map plotting with various
map projections
In cartography, map projection is the term used to describe a broad set of transformations employed to represent the two-dimensional curved surface of a globe on a plane. In a map projection, coordinates, often expressed as latitude and longi ...
,
coastlines, and political boundaries
*Cartopy: a mapping library featuring object-oriented map projection definitions, and arbitrary point, line,
polygon
In geometry, a polygon () is a plane figure that is described by a finite number of straight line segments connected to form a closed '' polygonal chain'' (or ''polygonal circuit''). The bounded plane region, the bounding circuit, or the two t ...
and image transformation capabilities.
(Matplotlib v1.2 and above)
*Excel tools: utilities for exchanging data with
Microsoft Excel
Microsoft Excel is a spreadsheet developed by Microsoft for Windows, macOS, Android and iOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a macro programming language called Visual Basic for ...
*GTK tools: interface to the GTK library
*Qt interface
*Mplot3d: 3-D plots
*Natgrid: interface to the natgrid library for gridding irregularly spaced data.
*tikzplotlib: export to Pgfplots for smooth integration into
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latexes are found in nature, but synthetic latexes are common as well.
In nature, latex is found as a milky fluid found in 10% of all flowering plants (angiosper ...
documents (formerly known as ''matplotlib2tikz'')
* Seaborn: provides an API on top of Matplotlib that offers sane choices for plot style and color defaults, defines simple high-level functions for common statistical plot types, and integrates with the functionality provided by
Pandas
Related projects
* Biggles
* Chaco
*
DISLIN
DISLIN is a high-level plotting library developed by Helmut Michels at the Max Planck Institute for Solar System Research in Göttingen, Germany. Helmut Michels has worked as a mathematician and Unix system manager at the computer center of the ...
*
GNU Octave
*
Gnuplot-py
*
PLplot – Python bindings available
*
PyCha
–
libcairo implementation
*
PyPlotter
– compatible with
Jython
Jython is an implementation of the Python programming language designed to run on the Java platform. The implementation was formerly known as JPython until 1999.
Overview
Jython programs can import and use any Java class. Except for some stand ...
*
SageMath
SageMath (previously Sage or SAGE, "System for Algebra and Geometry Experimentation") is a computer algebra system (CAS) with features covering many aspects of mathematics, including algebra, combinatorics, graph theory, numerical analysis, nu ...
– uses
Matplotlib
to draw plots
* SciPy (modules
plt
and
gplt
)
* wxPython (module
wx.lib.plot.py
)
*
Plotly
Plotly is a technical computing company headquartered in Montreal, Quebec, that develops online data analytics and data visualization, visualization tools. Plotly provides online graphing, analytics, and statistics tools for individuals and coll ...
– for interactive, online Matplotlib and Python graphs
* Bokeh
– Python interactive visualization library that targets modern web browsers for presentation
References
External links
*
{{SciPy ecosystem
Articles with example Python (programming language) code
Free plotting software
Free software programmed in Python
Python (programming language) scientific libraries
Science software that uses GTK
Science software that uses Qt