Bar Plot in Matplotlib
Machine Learning courses with 100+ Real-time projects Start Now!!
Program 1
import matplotlib.pyplot as plt
x=[2021,2022,2023,2024,2025]
y=[3200,5000,4500,5500,3400]
mycolors=['red','green','blue','black','yellow']
plt.figure(figsize=(8,10))
#plt.bar(x,y,width=0.3,color=mycolors)
#plt.barh(x,y,height=0.3,color=mycolors)
fc={'family':'Times New Roman','size':20,'color':'r'}
fc1={'family':'Times New Roman','size':25,'color':'g'}
fc2={'family':'Verdana','size':30,'color':'b'}
plt.title("Product (Mobile) Details of Last 5 Year",fontdict=fc)
plt.xlabel("Year(Last 5 Year)",fontdict=fc1)
plt.ylabel("Product(Mobile)",fontdict=fc2)
plt.show()
Your opinion matters
Please write your valuable feedback about DataFlair on Google

