Introduction to MATPLOTLIB

MATPLOTLIB – What is it?

If you’re interested in data analytics or data visualization, you’ve come to the right place. So, to begin, data visualization is the process of converting numbers, text, or massive data sets into various sorts of graphs such as histograms, maps, bar plots, pie charts, and so on. Some tools or technologies are required for visualizations. Matplotlib is one of Python’s most capable data visualization packages. In this post, I’ll show you how to simply display several sorts of graphs and charts to communicate your data to someone.

Python has dozens of modules, and Matplotlib is one of the most sophisticated data visualization tools in Python. Matplotlib strives to make simple things simple and difficult things feasible. With just a few lines of code, you can make plots, histograms, power spectra, bar charts, errorcharts, scatterplots, and so on.

Matplotlib is an open-source drawing library that supports a wide range of drawing formats. In Python, the Matplotlib package is used to create static, animated, and interactive 2D plots or figures. It’s frequently seen in web application servers, shells, and Python programs. Matplotlib was created in 2003 by John D. Hunter.

matplotlib

How to install?

if you are using python as independent installation, you shall execute following command in python prompt:

pip install matplotlib

If you are using anaconda distrbution, than matplotlib is default installation. But in case if it s required to install, you may try this:

conda install matplotlib

Let’s look at how to install Matplotlib in Google-Colab. Colab Notebooks are similar to Jupyter Notebooks in that they operate on the cloud. It is also linked to our Google Drive, making it much easier to access our Colab notebooks at any time, from any location, and on any device. The PIP command is used to install Matplotlib.

!pip install matplotlib

How to use?

There are two alternatives to fetch the plotting functions:

from matplotlib import pyplot as plt

or

import matplotlib.pyplot as plt

The later approach is more convinient and more popular.

Matplotlib provides different types of plots including:

  • Line plot
  • Histogram
  • Bar Chart
  • Scatter plot
  • Pie charts
  • Boxplot
  • wordcloud
  • Countour
  • 3D plotting