Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Customizing Bar Charts | Bar Charts
course content

Course Content

Visualization in Python with matplotlib

Customizing Bar ChartsCustomizing Bar Charts

Nicely done! You've built many interesting bar charts. Now it's time to add some information to make the plots informative.

Like, in the previous chapters, we can use the .set() function applied to the Axes object to set the following parameters: xlabel, ylabel for labels on the axes, xlim, ylim to limit values on the axes (this parameters must have list/tuple as a value), title for chart title. Also, to improve the readability we can add values above (or right/left) to each bar. To do it, we should save in separate variable each call of .bar() (or .barh()) function, and then call the .bar_label() applied to Axes object, passing saved .bar() function call as the first argument, and padding as the second (optional, the distance between bar and text). For example,

Everything was clear?

Section 2. Chapter 9
course content

Course Content

Visualization in Python with matplotlib

Customizing Bar ChartsCustomizing Bar Charts

Nicely done! You've built many interesting bar charts. Now it's time to add some information to make the plots informative.

Like, in the previous chapters, we can use the .set() function applied to the Axes object to set the following parameters: xlabel, ylabel for labels on the axes, xlim, ylim to limit values on the axes (this parameters must have list/tuple as a value), title for chart title. Also, to improve the readability we can add values above (or right/left) to each bar. To do it, we should save in separate variable each call of .bar() (or .barh()) function, and then call the .bar_label() applied to Axes object, passing saved .bar() function call as the first argument, and padding as the second (optional, the distance between bar and text). For example,

Everything was clear?

Section 2. Chapter 9
some-alt