Section 1 - Instruction

Time to explore line plots! Unlike bar charts that compare separate categories, line plots excel at showing how a value changes continuously—like tracking stock prices over time.

Engagement Message

What's something in your life that changes continuously over time?

Section 2 - Instruction

Line plots connect data points with lines, creating a visual flow that makes trends obvious. The line helps your eye follow the pattern smoothly from one point to the next.

Engagement Message

Why might this be better for showing a trend than just scattered dots?

Section 3 - Instruction

To create a line plot, you need two lists of equal length: one for your x-axis values (often time periods) and one for your y-axis values (the measurement you're tracking).

Engagement Message

If tracking monthly sales, what would your two lists contain?

Section 4 - Instruction

In Matplotlib, you use the ax.plot() method. You provide your x-values list and your y-values list, and it automatically plots the points and connects them with lines.

ax.plot(months, sales_data)

Engagement Message

Let's look at a complete example, shall we?

Section 5 - Instruction

Here is the full code to plot temperature changes over a week:

Engagement Message

What do you think this plot would look like?

Section 6 - Instruction
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal