Introduction to Matplotlib
Introduction to Matplotlib tutorial for Python Library helps you to understand the package need to import and basic function plot() show() function for pyplot
How to install Matplotlib
Please install pip before installing Matplotlib. Once pip is installed you can simply run the following command to install the matplotlib package.
pip install matplotlib
If you need more help for installation please visit matplotlib official website
A quick start with Matplotlib
Once the installation is done. You need to import pyplot from matplotlib package.
import matplotlib.pyplot as plt
To plot the graph we need x and y coordinates. plot() can take two lists arguments. For example x = [1,2,3] and y =[4,5,7]
plt.plot([1,2,3],[4,5,7])
In order to show the final plot, we need to use the show function.
plt.show()
The above three code lines are shown below in the Python online code editor. You can play with the below code shown in the editor by entering your own value for x and y lists.