Bar Plot or Bar Chart in Python with legend - DataScience Made Simple Line number 8, bar () function takes both the axis as input, sets color as blue and border color as black. Line number 9, xticks () function takes value as labels i.e. label of cities and happiness_index as input and plots the label Line number 10 to 13, plots x label, y label and title and shows the output. Horizontal Bar Chart in Python: 1 2 3 4