matplotlib

{{Short description|Library for creating visualizations in Python}}

{{Infobox software

| name = Matplotlib

| logo = Matplotlib logo.svg

| logo size = 300px

| screenshot = File:Mpl screenshot figures and code.png

| caption = Screenshot of Matplotlib plots and code

| collapsible =

| author = John D. Hunter

| developer = Michael Droettboom, et al.

| released = {{Start date and age|df=yes|2003}}{{cite web|url=https://matplotlib.org/users/license.html#copyright-policy | title=Copyright Policy}}

| latest release version = {{wikidata|property|edit|reference|P348}}

| latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}

| latest preview version =

| latest preview date =

| engine = Cairo, Anti-Grain Geometry

| discontinued =

| programming language = Python

| operating system = Cross-platform

| platform =

| size =

| language =

| genre = Plotting

| license = [https://matplotlib.org/users/license.html Matplotlib license]

| website = {{URL|https://matplotlib.org}}

}}

Matplotlib (portmanteau of MATLAB, plot, and library{{cite web | url=https://matplotlib.org/stable/project/history.html | title=History — Matplotlib 3.9.2 documentation }}) 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.{{cite web|title=API Overview|url=https://matplotlib.org/stable/api/index.html#module-pylab|publisher=matplotlib.org}} SciPy makes use of Matplotlib.

Matplotlib was originally written by John D. Hunter. Since then it has had an active development community{{cite web |url=https://matplotlib.org/users/github_stats.html |title=Matplotlib github stats |publisher=matplotlib.org }} 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{{cite web |url=http://matplotlib.1069221.n5.nabble.com/ANN-Michael-Droettboom-matplotlib-lead-developer-td5037.html |title=Announcing Michael Droettboom as the lead Matplotlib developer |publisher=matplotlib.org |access-date=2013-04-24 |archive-date=2020-10-27 |archive-url=https://web.archive.org/web/20201027122844/http://matplotlib.1069221.n5.nabble.com/ANN-Michael-Droettboom-matplotlib-lead-developer-td5037.html |url-status=dead }} and was further joined by Thomas Caswell.{{Cite news|url=https://www.numfocus.org/blog/matplotlib-lead-developer-explains-why-he-cant-fix-the-docs-but-you-can|title=Matplotlib Lead Developer Explains Why He Can't Fix the Docs—But You Can – NumFOCUS|date=2017-10-05|work=NumFOCUS|access-date=2018-04-11|language=en-US}}{{Cite web|url=https://matplotlib.org/users/credits.html|title=Credits – Matplotlib 2.2.2 documentation|website=matplotlib.org|access-date=2018-04-11}} Matplotlib is a NumFOCUS fiscally sponsored project.{{cite web|title=NumFOCUS Sponsored Projects|url=https://numfocus.org/sponsored-projects|publisher=NumFOCUS|access-date=2021-10-25}}

Usage

Matplotlib is used in scientific research as a tool for data visualization. For example, the Event Horizon Telescope collaboration used Matplotlib to produce visualizations during the effort to create the first image of a black hole.{{cite web |title=Case Study: First Image of a Black Hole |url=https://numpy.org/case-studies/blackhole-image/ |website=NumPy |access-date=22 April 2025}} Matplotlib also underpins the plotting functionality of many scientific Python libraries (for instance, pandas uses Matplotlib as its default backend for plotting). Its importance to the scientific community has been acknowledged by institutions such as NASA, which in 2024 awarded a grant to support Matplotlib’s continued development as part of an initiative to fund widely used open-source scientific software.{{cite web |title=NASA Funds Open-Source Software Underpinning Scientific Innovation |url=https://www.nasa.gov/news-release/nasa-funds-open-source-software-underpinning-scientific-innovation/ |website=NASA |access-date=22 April 2025}}

File:Matplotlib in jupyter notebook.png

In education and data science, Matplotlib is frequently used to teach programming and data visualization. It integrates with Jupyter Notebook, allowing students and instructors to generate inline plots and interactively explore data within a notebook environment.{{cite news |title=Interactive notebooks: Sharing the code |url=https://www.nature.com/articles/d41586-018-07196-1 |work=Nature |date=18 September 2018 |access-date=22 April 2025}} Many educational institutions incorporate Matplotlib into their curricula for teaching STEM concepts,{{cite web |title=Pyplot tutorial |url=https://matplotlib.org/stable/tutorials/introductory/pyplot.html |website=Matplotlib |access-date=22 April 2025}} and it is widely featured in tutorials, workshops, and open online courses as a primary plotting library.

Related projects

References

{{Reflist|2}}