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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.