A plotting library

Matplotlib offers so many options that you may have trouble deciding on which ones to use for your plots.

Matplotlib [1] is an open source Python library for high-quality data visualization, which you can use interactively or inside scripts. While Matplotlib might look like just a supercharged version of the venerable plotting utility Gnuplot [2], that’s not the whole story. Matplotlib really shines in the integration of charting with heavy numeric processing. When combined with other Python libraries, such as NumPy and pandas (see the “Matplotlib’s Partners: NumPy and pandas” box), Matplotlib is often considered an effective open source alternative to MATLAB [3].

Some tools have steeper learning curves than others. In my opinion, Matplotlib’s learning curve is wider, not steeper than average. For example, Matplotlib has an entire tutorial devoted to colors specifications! In other words, Matplotlib has so many features and options that it looks much more complex than it actually is. For this reason, much of this tutorial uses simplified versions of some official examples to introduce the main Matplotlib concepts and features and connects the dots between them.

Install Procedure

You will find several ways to install the most recent stable version of Matplotlib, all properly documented on its website. However, unless you really need the LATEST stable version, I strongly suggest that you save time and frustration by installing whatever binary packages are available in your preferred distribution’s official repository. On Ubuntu 21.04, for example, you can install a recent Matplotlib and all its dependencies by just searching for it in the Ubuntu Software Center or, as I did, by typing this command at the prompt:


Use Express-Checkout link below to read the full article (PDF).

Posted by Contributor