Here, we are executing a python program to make a bar roast utilizing matplotlib.pyplot.
Issue proclamation: Write a python program utilizing matplotlib.pyplot library to make a bar graph.
A bar outline or reference diagram is a diagram or chart that presents straight out information with rectangular bars.
import matplotlib.pyplot as plt x = [2,4,6,8,10] y=[3,9,11,2,6] plt.bar(x,y,label ='Bars') plt.xlabel('X-axis') plt.ylabel('Y-axis') plt.title('Bar Graph1') plt.legend() plt.show()
Python library matplotlib.pyplot is utilized to draw the above outline. Two irregular factors x and y are taken with arbitrary qualities. The bar work plots a bar plot.
The bar work takes 2 contentions, for example, x and y and a marked variable give the name to the plot. To name the tomahawks xlabel and ylabel capacities are utilized and to give the title to the plot the title work is utilized. To show the legend work is utilized lastly to show the plot the show work.