Matplotlib is a third-party python library that you can use to create various graphs as well as charts to present your data. This is the starting article of the 10 parts series of the Matplotlib library tutorial and in this example tutorial, I will create a simple graph to represent the five-day shoe sales data as follows:-
First of all, just like other third-party python libraries, you will need to import Matplotlib into your python program.
import matplotlib.pyplot as plt
As you can see I am using the matplotlib.pyplot module to plot the below graph.
plt.ylabel('Total Daily Sales') plt.xlabel('Five Day Sale') plt.title("Shoe Sale Data") plt.show()
I have set the y and x labels as well as the title of the graph. The show method of that module will display the graph on the screen!
With only a few lines of code, I can actually plot the entire data points and display them on the graph!