Definition · Plain-language
Matplotlib
Matplotlib is a low-level plotting library for the Python programming language that allows researchers to construct highly customisable static and interactive visualisations.
The step most authors miss
Doing CRediT right? Don’t stop at the statement.
A CRediT statement credits you inside one paper. The recognition CRediT was built for happens when those roles are tied to you, persistently. Sign in with your ORCID — free — and claim your CRediT contributions on casrai.org, the home of the standard. They become a verified, portable part of your identity, not a line that disappears into one PDF.
Free: claim your contributions, then export a journal-ready CRediT statement, schema.org structured data, JATS XML, CSV or BibTeX — and preview your public profile. A membership publishes that profile publicly and verifies the journals you serve.
The foundation of Python data visualisation
Matplotlib is the foundational data plotting library for the Python programming language, developed by John D. Hunter in 2003 to replicate MATLAB’s plotting capabilities. As an open-source project distributed under a BSD-compatible licence, it is free to use and forms the graphics engine for high-level libraries like Seaborn and Pandas plotting. Academic researchers across physics, biology, and chemistry utilise Matplotlib to construct diverse visualisations, ranging from simple scatter plots to complex three-dimensional charts. The library is highly valued for its stability, extensive documentation, and ability to handle large numerical arrays. It is integrated into scientific workflows, allowing users to generate high-resolution figures that are crucial for scientific research.
Understanding the Pyplot interface
Matplotlib provides two primary development interfaces: the state-based Pyplot module and a robust object-oriented API. The Pyplot module mimics MATLAB’s scripting behaviour, allowing researchers to generate charts quickly using minimal code commands. However, for multi-panel figures and complex publications, researchers prefer the object-oriented approach. This methodology requires developers to explicitly define Figure and Axes objects, granting them complete control over individual subplots, legend coordinates, and grid layouts. By manipulating these components directly, researchers can design custom visualisations without relying on global state changes. This dual interface system makes the library versatile, catering to both quick exploratory plotting and structured software development.
Customisation and scientific publication
Matplotlib is famous for its extreme customisation capabilities, enabling researchers to meet the strict formatting guidelines of academic journals. Users can configure fonts, colours, tick marks, and margins down to the pixel level, and render mathematical equations using LaTeX formatting. Additionally, it supports interactive features, enabling users to zoom, pan, and inspect data points dynamically. For print publications, Matplotlib exports figures in vector formats like PDF, SVG, and EPS, ensuring that charts remain sharp when scaled. By offering such precise control over visual layouts, Matplotlib remains a dominant tool in academic publishing, outperforming many basic spreadsheet software tools. Furthermore, researchers can save their custom styling configurations as stylesheet files, ensuring visual consistency across multiple figures in a research programme or journal article. This level of automation and precision makes it indispensable for publication.
Key facts
At a glance
- Core purpose: generating publication-grade static, animated, and interactive plots in Python.
- MATLAB compatibility: includes the Pyplot module designed to emulate MATLAB plotting commands.
- Licensing: open-source software distributed under a permissive BSD-compatible license.
- Extensibility: serves as the graphics engine for Seaborn, Pandas, and other data libraries.
- Vector support: exports figures to SVG, PDF, and EPS formats for high-resolution publishing.
- Mathematical rendering: supports LaTeX equations natively for axis titles and labels.
Common misconceptions
What people often get wrong
Often heard: Matplotlib is outdated compared to Seaborn.
Actually: Seaborn is built on top of Matplotlib, not as a replacement. Knowing Matplotlib is essential for customising Seaborn plots, as Seaborn returns Matplotlib Axes objects.
Often heard: Matplotlib can only produce basic, unappealing charts.
Actually: Matplotlib's default styling was simple, but modern versions feature customisable style sheets, allowing researchers to easily apply modern design themes.
Common questions
FAQ
How do I save a plot in Matplotlib?+
You can save a plot using the plt.savefig() function. You can specify the filename and format, such as plt.savefig('my_plot.pdf', dpi=300), which automatically saves a high-resolution PDF.
What is the difference between Figure and Axes in Matplotlib?+
The Figure is the overall canvas that contains all elements of the plot, including subplots, titles, and legends. The Axes is the actual subplot where data is plotted, containing the x-axis, y-axis, and data points.
Going deeper







