Locked lesson.
About this lesson
Use these steps to add a Bubble Chart to your spreadsheet.
Exercise files
Download this lesson’s related exercise files.
36 - Bubble Chart.docx60.4 KB 36 - Bubble Chart SOLUTION.docx
57.1 KB
Quick reference
Bubble Chart
In this video we'll look at Bubble Charts.
When to use
Use these whenever you need a Bubble Chart in your spreadsheet.
Instructions
# Import the charts
from openpyxl.chart import Reference, Series, BubbleChart
# Create a Chart instance
chart = BubbleChart()
# Load data differently than other charts
xvalues = Reference(ws, min_col=1, min_row=2, max_row=5)
yvalues = Reference(ws, min_col=2, min_row=2, max_row=5)
size = Reference(ws, min_col=3, min_row=2, max_row=5)
series = Series(values=yvalues, xvalues=xvalues, zvalues=size, title="2020")
chart.series.append(series)
# Add second set of data
xvalues = Reference(ws, min_col=1, min_row=7, max_row=10)
yvalues = Reference(ws, min_col=2, min_row=7, max_row=10)
size = Reference(ws, min_col=3, min_row=7, max_row=10)
series = Series(values=yvalues, xvalues=xvalues, zvalues=size, title="2021")
chart.series.append(series)
Hints & tips
- from openpyxl.chart import Reference, Series, BubbleChart
- chart = BubbleChart()
- Bubble Charts load data differently than other charts
Lesson notes are only available for subscribers.