> ## Documentation Index
> Fetch the complete documentation index at: https://base.bangwu.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Matplotlib

> Matplotlib is Python's main 2D plotting library for publication-quality figures, covering pyplot for line charts, histograms, and scatter plots.

# 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](http://ipython.org/) shell, [Jupyter](http://jupyter.org/) 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](https://www.matplotlib.org.cn/tutorials/introductory/sample_plots.html) and the [gallery](https://www.matplotlib.org.cn/gallery/index.html) for inspiration.

![img](https://bangwu.oss-cn-shanghai.aliyuncs.com/img/202305130748189.png)

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](https://www.matplotlib.org.cn/gallery) and the [pyplot command reference](https://matplotlib.org/api/pyplot_summary.html). 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.
