How to Plot Multiple Bars in Single Bar Graph in Matplotlib
Program 1 import matplotlib.pyplot as mat years=[2019,2020,2021,2022,2023] frooti=[300,500,200,600,400] pepsi=[300,200,400,500,350] limca=[400,200,300,600,500] wd=0.2 f_bar=[0,1,2,3,4] #print(f_bar) p_bar=[i+wd for i in f_bar] l_bar=(i+wd for i in p_bar) #print(p_bar) mat.bar(f_bar,frooti,width=wd,color=’red’,label=”Frooti”) mat.bar(p_bar,pepsi,width=wd,color=’blue’,label=”Pepsi”) mat.bar(l_bar,limca,width=wd,color=’yellow’,label=”Limca”) mat.title(“Produt Details(5 Year)”) mat.legend() mat.show()