Thanks to theidioms.com

Learn Matplotlib for Data Science (Course III)

Learn Matplotlib for Data Science (Course III)

Introduction to Matplotlib Plots

introduction to matplotlib

Matplotlib is a data visualization library in Python used for plotting static, animated and interactive visualizations with a high level of flexibility. In Python, there are multiple kinds of Matplotlib plots available and in this course, we will go over everything from an introduction to Matplotlib to creating 3D Matplotlib plots.

Installing Matplotlib in Python using pip

Matplotlib can be installed using the Python Package Manager, pip, as follows:

$ pip install matplotlib

Note: If you are using Anaconda, Matplotlib comes pre-installed.

Importing Matplotlib in Python

Starting from this section onwards, we will be using Jupyter Notebooks as our Python IDE.

To import Matplotlib in Python, write the following code and run it:

# Libraries/Modules import conventions
import matplotlib as mpl
import matplotlib.pyplot as plt  

# For interactive matplotlib sessions, turn on the matplotlib inline mode
%matplotlib inline

Check Matplotlib version in Python

To check the version of the installed Matplotlib library, write the following code and run it:

# Check version of matplotlib installed
print(mpl.__version__) #Printed version: 3.1.1

The output of the code will be displayed as following in Jupyter Notebook:

Introduction to Matplotlib Plots

If your Matplotlib version is greater than 3.0.0, then everything is now ready!

This is it for the basic introduction to Matplotlib. Now you are ready to start plotting your own Matplotlib plots in Python. Head over to the next chapter and learn the basics of a Matplotlib plot.

Leave your thought here

Your email address will not be published. Required fields are marked *

Close Bitnami banner
Bitnami