Matplotlib PyPlot API
In this tutorial, we will cover the Pyplot API in Matplotlib in detail, helping you understand the use of Pyplot API in Matplotlib.
matplotlib.pyplot is basically the collection of command style functions that helps in making the Matplotlib work like MATLAB.
pyplotis mainly intended in Matplotlib for making interactive plots and simple cases of programmatic plot generation.
Each function in pyplot makes some changes to the figure, for example, there is a function to create a figure, for creating a plotting area in a figure, for plotting some lines in the plotting area, for decorating the plot with labels, etc.
New Notebook in Jupyter Notebook
If you want to create a new notebook in Jupyter notebook where you desire to store your work then we have shown you the option in our previous tutorial. Now when you click on the "New" button then there you have options like Python3, terminal, folder, etc.
Just click on Python3 and then there is a python Notebook for you that will be saved with (
Let us show you an image then it becomes clear to you:
Now in this notebook, you can run your commands, can draw any kind of plot, histogram, or anything you want using Matplotlib, run it, and then save it.
Different type of Plots
Let us now discuss different types of plots that can be visualized with the help of Matplotlib library:
This will create a Bar plot.
This will create a histogram.
This will create a 2-dimensional histogram.
This will create a Pie chart.
This will create a Box and whisker plot.
This will help to plot lines.
This will be used to draw a scatter plot of
This is used to draw a stacked area plot.
This will help to plot a 2-dimensional field of arrows.
This will draw a stem plot.
This will draw a polar plot.
This will draw a stem plot.
Different type of Figure Functions
Let us discuss some functions related to figures in Matplotlib and these are given below:
This will create a new figure.
This is used to add text to the figure.
This is used to save the current figure.
This is used to display the figure.
This is used to close the window of the figure.
Different type of Image Functions
Let us discuss some functions related to images in Matplotlib:
This function is used to read an image from a file into an array
This function is used to save an array in an image file.
This is used to display the image on the axes.
Different types of Axis Functions
let us discuss some functions related to the axis in Matplotlib:
This is used to add axes to the figure.
This is used to add the text to the Axes.
This is used to set a title of the current axes
This is used to Set the x-axis label of the current axis
This is used to Set the y-axis label of the current axis
This is used either to Get or set the x-limits of the current tick locations and labels.
This is used either to Get or set the y-limits of the current tick locations and labels.
This is used to set the scaling of the x-axis.
This is used to set the scaling of the y-axis.
This is used to either Get or set the x-limits of the current axes
This is used to either Get or set the y-limits of the current axes
In this tutorial, we covered the various useful functions and properties of the Pyplot API in Matplotlib library.