BuildlyBuildly
DashboardExercisesProfileHelp
Data Science/Module 4: Data Visualization/Matplotlib Customization3/3
Exercise·7 min·10 XP

Add a Legend

Context. Online and in-store sales share one chart. Without a legend nobody knows which line is which.

Your task. Write make_legend_chart(months, online, store) that plots two lines — online labeled "Online", store labeled "Store" (in that order) — adds a legend, and returns the axes.

Example. Pass label="Online" to the first plot call, then ax.legend() picks the labels up.

Notes. Plot Online first, Store second — the legend order follows plotting order. Labels are case-sensitive.

Previous
Title and Label a Chart
Next
Style the Sales Line