Mat Plot Lib
Mat Plot Lib
MATPLOTLIB
Submitted by:
Dilasha Rajkarnikar(ACE076BCT036)
Drishya Bhattarai(ACE076BCT037)
Bishal Manandhar(ACE076BCT032)
What is Matplotlib?
OR
It means we are importing the pyplot module of matplotlib into our namespace
as plt.
Pyplot
Pyplot is a Matplotlib module that provides simple functions for adding plot elements,
such as lines, images, text, etc. to the axes in the current figure.
All commands like plot() , scatter() etc reside in the pyplot module.
Let us take an example that uses Matplotlib.
The first array appears on the x-axis, and the second array appears on
the y-axis of the plot.
Titles and Labels
We can add a title, as well as the x-axis and y-axis names, using the following methods:
● title()
● xlabel()
● ylabel()
Xlabel: X-axis
Ylabel: Y-axis
Figure size
Users can also specify the size of the figure using the figure() method.
Matplotlib subplots
You can use the subplot() method to add more than one plot in a figure.
The three-integer arguments specify the number of rows and columns and
the index of the subplot grid.
Example:
add_subplot() function
The add_subplot() function of the figure class enables us to add a graph inside a
graph.
Important Types of Plot
● Bar graphs
● Histograms
● Scatter plots
Bar Graphs
A bar graph presents data with heights and lengths proportional to the
values they present.
fig = plt.figure()
ax = plt.axes(projection='3d')
Example:
Thank You!