# Python Matplotlib Tutorial – Mastery in Matplotlib Library

## Python Matplotlib Tutorial

After complication of python NumPy Tutorial and python pandas tutorial. Now, we jump on the **python matplotlib tutorial** to become a master in it.

### What is python matplotlib?

Matplotlib is a 2D and 3D graph plotting python library. It also supports to create animations and images. This is an advanced part of **python matplotlib**.

Using python matplotlib, you can draw a different graph like below:

**Line plot****Histogram****Bar Chart****Pie Chart****Scatterplots****Area Plot****Error charts****Power Spectra****etc.**

Other topics:

#### Why use matplotlib?

As a machine learning engineer or data scientist, data analysis is a part of model development. Looking numeric data, you can’t get correct insights. So the best way to plot a graph using that data and take a decision for further process. Data visualization is a process take after the data cleaning.

### History of matplotlib

The American neurologist **John D. Hunter ***(1968 – 2012), *wanted to draw some graph regarding their project. This was the main reason to develop matplotlib python graph plotting library. The matplotlib has written in the Python programming language. As initially, It had been released in 2003. Now, matplotlib is the popular graph plotting library.

For more details, jump on the official site of matplotlib.

### Dependency of Matplotlib

The matplotlib is depended on some third-party python library like NumPy.

### Download and Install Matplotlib

The matplotlib installation process is very simple. If you are using Anaconda Navigator, then no need to install matplotlib. If you are using Python idle, PyCharm, Sublime Text, etc, then follow the below steps.

Open the command prompt or terminal and enter

```
pip install matplotlib
```

and press **Enter key **to download and install matplotlib. The **pip** is a package, which installs the matplotlib python library.

### Importing Matplotlib

For plotting graph, need to import matplotlib in the python file. Here is two way to import matplotlib given below.

```
from matplotlib import pyplot as plt # importing pyplot module from matplotlib library
# or
import matplotlib.pyplot as plt # importing pyplot module from
```

In the above code, we import the pyplot module from matplotlib for plot the graphs, like histogram, bar chart, pie plot, etc.

**The official study material for matplotlib**

Matplotlib Tutorial – click here

### Conclusion

I hope, you followed the python matplotlib tutorial and did practical. I am suggesting to you, try to use all the parameters of each method for a better understanding.

After completion of the matplotlib tutorial jump on python

seaborn tutorial.It is advance python data visualization library build on top of the matplotlib.