Thanks to theidioms.com

Installing and Importing Matplotlib

matplotlib full course
Tutorial

Installing and Importing Matplotlib

Installing and Importing MatplotlibInstalling and Importing Matplotlib

Matplotlib is a data visualization library in Python used for plotting static, animated, and interactive visualizations with a high level of flexibility.

introduction to matplotlib

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:

Installing and Importing Matplotlib

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 on ‘Basics of Matplotlib‘.


Are you interested in working with data? Get a free trial month of LinkedIn Learning and learn Data Science and Machine Learning courses using Python, R, and SQL from top instructors.

Enroll in any one of the courses from the following fields today on LinkedIn Learning and start your free month of learning:

Disclaimer: When you subscribe to LinkedIn Learning, we may earn a small commission as an affiliate. We love the platform so much so that we have been using it ourselves at The Click Reader.

Installing and Importing MatplotlibInstalling and Importing Matplotlib

Leave your thought here

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