Stuck on Multiple Plots Concept

Screen Link:

Multiple Plots.ipynb (349.5 KB)

What actually happened:

Line 27, when I do this
subset = unrate[start:end]['MONTH'], unrate[start:end]['VALUE'] plt.plot(subset, colors[i])

I end up with alot of crazy zigzag lines, which is not supposed to happen.

Can someone help me understand why my code is not working?

Thank you!

Click here to view the jupyter notebook file in a new tab

Hi laurenk9304
Please refer docs for the signature of plot() method.

plot([x], y, [fmt], *, data=None, **kwargs)
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)

So you’ll have to provide data for x and y coordinates separately, i.e. unrate[start:end]['MONTH'] for x coordinate and unrate[start:end]['VALUE'] for y coordinate.

The correct code should have been

plt.plot(subset['MONTH'], subset['VALUE'], c=colors[i], label=label)

instead of

plt.plot(subset, colors[i])

Hope its clear now.
Thanks.