Bar Plot
Bar Plot : import matplotlib.pyplot as plt a = ["math","science","english"] b = [60,70,80] plt.bar(a,b) plt.show() Horizontal bar plot : import matplotlib.pyplot as plt a = ["math","science","english"] b = [60,70,80] plt.barh(a,b) plt.show() Customizing Bar Plot : import matplotlib.pyplot as plt a = ["math","science","english"] b = [60,70,80] fig = plt. figure( figsize = (10,5) ) plt.bar(a,b,color = "green",alpha = 0.8) plt.legend(["marks"] , loc = "best") plt.xlabel("Subject") plt.ylabel("marks") plt.show() Adding Two Bar Plot : import matplotlib.pyplot as plt a = ["math","science","english"] b = [60,70,80] a1= [" marathi" ,"algebra", "history", "geography"] b1= [40,55,65,85] fig = plt. figure( figsize = (10,5) ) x = plt. subplot(1,2,1...
Comments
Post a Comment
If you have any doubts, please let me know