Matplotlib

Matplotlib is the data visualization library in Python and it allows us to generate plots, histograms, power spectra, bar charts, error charts, scatter plots, and so on, using a few lines of code. Matplotlib usually make things easier and the hardest things possible.

To use matplotlib in your Python program, first we have to install matplotlib. Run the following command in your Terminal to install matplotlib:

$ pip3 install matplotlib

Now, you have to install one more package, tkinter, for graphical representations. Install it using the following command:

$ sudo apt install python3-tk

Now that matplotlib is installed in your system, we will look at some examples. While plotting, there are two important components: figures and axes. ...

Get Mastering Python Scripting for System Administrators now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.