HOME

TheInfoList



OR:

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 vir ...
for the
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
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 pro ...
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
for embedding plots into applications using general-purpose
GUI toolkit The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inst ...
s like
Tkinter Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's ''de facto'' standard GUI. Tkinter is included with standard Linux, Microsoft Windows and macOS installs of Python. T ...
,
wxPython wxPython is a wrapper for the cross-platform GUI API (often referred to as a "toolkit") wxWidgets (which is written in C++) for the Python programming language. It is one of the alternatives to Tkinter. It is implemented as a Python extensio ...
, Qt, or
GTK GTK (formerly GIMP ToolKit and GTK+) is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and propriet ...
. There is also a procedural "pylab" interface based on a
state machine A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
(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 hardwa ...
), 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, implementation ...
, though its use is discouraged.
SciPy SciPy (pronounced "sigh pie") is a free and open-source Python library used for scientific computing and technical computing. SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal ...
makes use of Matplotlib. Matplotlib was originally written by John D. Hunter. Since then it has had an active development community and is distributed under a
BSD-style license BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the use and distribution of covered software. This is in contrast to copyleft licenses, which have share-alike requirements. The original BSD lice ...
. 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 comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
but have external dependencies. *Basemap: map plotting with various map projections,
coastlines The coast, also known as the coastline or seashore, is defined as the area where land meets the ocean, or as a line that forms the boundary between the land and the coastline. The Earth has around of coastline. Coasts are important zones in n ...
, 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 toge ...
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 Microsoft Windows, Windows, macOS, Android (operating system), Android and iOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a macro (comp ...
*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 (angiosperms ...
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 Pediatric autoimmune neuropsychiatric disorders associated with streptococcal infections (PANDAS) is a controversial hypothetical diagnosis for a subset of children with rapid onset of obsessive-compulsive disorder (OCD) or tic disorders. Sy ...


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 i ...
*
GNU Octave GNU Octave is a high-level programming language primarily intended for scientific computing and numerical computation. Octave helps in solving linear and nonlinear problems numerically, and for performing other numerical experiments using a langu ...
*
Gnuplot gnuplot is a command-line and GUI program that can generate two- and three-dimensional plots of functions, data, and data fits. The program runs on all major computers and operating systems (Linux, Unix, Microsoft Windows, macOS, FreeDOS, ...
-py *
PLplot PLplot is a library of subroutines that are often used to make scientific plots in compiled languages such as C, C++, D, Fortran, Ada, OCaml and Java. The library also exists as an unofficial binding for the .NET runtime. ''PLplot'' can als ...
– Python bindings available * PyChalibcairo 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 standa ...
*
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, numbe ...
– uses Matplotlib to draw plots * SciPy (modules plt and gplt) * wxPython (module wx.lib.plot.py) * Plotly – 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