Matplotlib Getting Started
The Matplotlib is being presented here to help you maximize your learning potential.
What is it?
Matplotlib is a low-level graph plotting library in Python that serves as a visualization tool – It was introduced in 2002 by John Hunter.
Data visualization is made easy with Matplotlib, a library built on NumPy arrays and intended for use with the broader SciPy framework – We can freely use it since it’s open source.
We can visualise enormous amounts of data in easily digestible visuals because visualization allows us visual access to them.
Several plot types are available in Matplotlib, including lines, bars, scatters, histograms, and more.
For platform compatibility, It is mainly written in Python, but there are a few segments written in C, Objective-C, and Javascript.
Install Matplotlib
Python and PIP must already be installed on a system for Matplotlib installation to take place.
PyPI offers wheel packages for macOS, Windows and Linux. You can install it using pip:
Example
You can also reach out to the community channel at conda-forge.
conda install -c conda-forge matplotlib
Managing Linux packages
Matplotlib can be installed via your package manager if you’re using the Python version provided with your Linux distribution, for instance:
For Red Hat and Centos:
sudo yum install python3-matplotlib
For Debian and Ubuntu:
sudo apt-get install python3-matplotlib
For Fedora:
sudo dnf install python3-matplotlib
Import Matplotlib
Matplotlib can be imported by adding the import module statement to your applications once it has been installed:
import matplotlib
Matplotlib has now been imported and is ready to be used:
Check Version
Version strings are stored in __version__ attributes.
Execute
Example
Please note that there are two underscore characters in the version attribute.
Uninstall:
The following command can be used if you need to remove Matplotlib from your Python for whatever reason:
pip uninstall matplotlib