Locked lesson.
About this lesson
In this lesson, we'll look at Bar Charts - Vertical, Horizontal, Stacked, and 3D - in a little more detail.
Exercise files
Download this lesson’s related exercise files.
31 - Bar Charts - Vertical, Horizontal, Stacked, and 3D.docx60.5 KB 31 - Bar Charts - Vertical, Horizontal, Stacked, and 3D SOLUTION.docx
56.7 KB
Quick reference
Bar Charts - Vertical, Horizontal, Stacked, and 3D
In this video we'll look at Bar Charts in a little more detail.
When to use
Use this whenever you need to use a Bar chart in your spreadsheet.
Instructions
# Import the charts
from openpyxl.chart import Reference, Series, BarChart3D
# Create a Chart instance
chart = BarChart3D()
# Give Axis titles
chart.y_axis.title = "Y Axis Title"
chart.x_axis.title = "X Axis Title"
# Change the shape of the bars
chart.shape = "pyramid"
Shapes include: pyramid, pyramidToMax, cylinder, box, coneToMax, cone
# Set style
chart.style = 5
# Change chart positioning
chart.type = 'bar' # default is col
# Make stacked
chart.grouping = 'stacked'
chart.overlap = 100
The rest stays the same from the last video.
Hints & tips
- chart = BarChart3D()
- chart.y_axis.title = "Y Axis Title"
- chart.x_axis.title = "X Axis Title"
- chart.shape = "pyramid"
- pyramid, pyramidToMax, cylinder, box, coneToMax, cone
- chart.style = 5
- chart.type = 'bar' #default is col
Lesson notes are only available for subscribers.