How to Create Vertical and Horizontal Bar Graph in Matplotlib
Machine Learning courses with 100+ Real-time projects Start Now!!
Program 1
import matplotlib.pyplot as mat
x=[2018,2019,2020,2021,2022]
y=[4000,3000,6000,5000,1500]
mycolor=['red','green','black','blue','yellow']
mat.bar(x,y,width=0.2,color=mycolor)
#mat.barh(x,y,height=0.2,color=mycolor)
mat.title("Product Details(5 Year)")
mat.xlabel("Year")
mat.ylabel("Frooti (Product")
mat.show()
Did you like this article? If Yes, please give DataFlair 5 Stars on Google

