Thanks to theidioms.com

Installing and Importing Matplotlib

matplotlib full course
Tutorial

Installing and Importing Matplotlib

Greetings! Some links on this site are affiliate links. That means that, if you choose to make a purchase, The Click Reader may earn a small commission at no extra cost to you. We greatly appreciate your support!

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‘.


Installing and Importing MatplotlibInstalling and Importing Matplotlib

Do you want to learn Python, Data Science, and Machine Learning while getting certified? Here are some best selling Datacamp courses that we recommend you enroll in:

  1. Introduction to Python (Free Course) - 1,000,000+ students already enrolled!
  2. Introduction to Data Science  in Python- 400,000+ students already enrolled!
  3. Introduction to TensorFlow for Deep Learning with Python - 90,000+ students already enrolled!
  4. Data Science and Machine Learning Bootcamp with R - 70,000+ students already enrolled!

Leave your thought here

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