Bar Charts
The bar graphs are used in data comparison where we can measure the changes over a period of time. It can be represented horizontally or vertically. The longer the bar it has the greater the value it contains.
In later lessons, we will use bar charts to see different kinds of categorical variables and compare balance in classes.
PYTHON
1fruits = ['Apple', 'Orange', 'Pineapple', 'JackFruit', 'Banana']
2amount = [23,17,35,40,12]
3
4fig = plt.figure()
5ax = fig.add_axes([0,0,1,1]) # [x0, y0, width, height]
6ax.bar(fruits,amount)
7ax.legend(labels=['Amount'])
8fig.show()
9
10px.bar(x=fruits, y=amount)
