Skip to main content

Introduction to Matplotlib

What is Matplotlib?

Matplotlib is a Python 2D plotting library that can generate publication-quality figures in many hard-copy formats and interactive environments. It can be used in Python scripts, the Python and IPython shell, Jupyter notebooks, web application servers, and multiple GUI toolkits. Matplotlib tries to make easy things easy and hard things possible. With just a few lines of code, you can create charts, histograms, power spectra, bar charts, error plots, scatter plots, and more. See the basic plotting examples and the gallery for inspiration. img For simple plotting, the pyplot module offers an interface similar to MATLAB, especially when used with IPython. Advanced users can also rely on the object-oriented API for full control over line styles, fonts, axes, and other details.

Learning from the official examples

If you want to learn how to draw a specific kind of chart, the best places to start are the gallery and the pyplot command reference. Do not be afraid of the official docs. Even when they are in English or lightly annotated, they are still the most complete reference. The translated pages are usually good enough for reading, and when a function is still hard to understand, you can always search the community or ask someone more experienced.
Last modified on April 17, 2026