Plot a graph in python using matplotlib
There are many libraries available in python to plot the graph.matplotlib is one of the widely used library to draw the graph.
Install matplotlib using pip command
1 |
pip install matplotlib |
matplotlib helps developer to visualize the data in a graph format.Developers write separate logic to find the x axis and y axis values based on business requirement.Then they will plot the graph using those values to predict the business growth in the upcoming years.
matplotlib providing the plot function to draw the graph.We can specify the x label and y label name to understand the graph in better way.Then the show function is display the output to the users.
Program to plot the graph
1 2 3 4 5 6 7 8 9 10 11 12 |
import matplotlib.pyplot as plt x=[1,5,7] y=[2,4,1] plt.plot(x,y) plt.xlabel('X axis') plt.ylabel('Y axis') plt.show() |