Matplotlib: Pylab Module

As we know Matplotlib is a which package in which Pyplot is a module and Pylab is installed alongside Matplotlib. It is a procedural interface to the Matplotlib Object-oriented programming language.

It provides a Matlab like namespace by importing functions from the modules Numpy and Matplotlib. Matplotlib is used for plotting and Numpy is used for mathematical and working with arrays. 

Pylab interface is more convenient for interactive calculations and plotting, as it minimizes typing.

Example

import pylab
import numpy as np
a=np.linspace(0, 20, 100)
b=np.cos(a)
pylab.plot(a,b)
pylab.show()

Output

pylab module

Fri, 11/26/2021 - 14:27

Authored by

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.
Tags