Matplotlib - bar()

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.bar.html

BAR GRAPH

Make a bar plot.


# matplotlib.pyplot.bar(x, height, width=0.8, bottom=None, *,
#     align='center', data=None, **kwargs)
#
# x : float or array-like; the x coordinates of the bars
# height : float or array-like; the height(s) of the bars
# width : float or array-like, default: 0.8, the width(s) of the bars

# bar1.py
import numpy as np
import matplotlib.pyplot as plt

x = np.arange(5)
y = [1,4,2,5,3]
plt.bar(x, height=y)
#plt.bar(x, y, width=0.5, color="green")
plt.xticks(x, list('abcde'))
plt.title("Bar graph")
plt.xlabel('Groups', color='red')
plt.ylabel('Results')
plt.show()

[ bar1.png ]