Code result issue on multiple plots - legend

Screen Link:

My Code:

fig = plt.figure(figsize=(10,6))
colors = ['red', 'blue', 'green', 'orange', 'black']
labels = ['1948', '1949', '1950', '1951', '1952']
for i in range(5):
    start_index = i*12
    end_index = (i+1)*12
    subset = unrate[start_index:end_index]
    plt.plot(subset['MONTH'], subset['VALUE'], c=colors[i], label=labels[i])
plt.legend(loc='upper left')

What I expected to happen:
Code to work.
Edit: it seems that provided solution does not get validated.

What actually happened:

Your 1st plot doesn't match what we expected.

Hello @julien.gatt, Welcome to the DataQuest Community.

Thanks for your reply. Actually, we need 2 charts for the answer to be validated which is weird since instructions asks to edit the code, same for the next question.

Hi All,

I am happy to announce this issue has been fixed. :tada:
Let me know if you are still experiencing this issue.


1 Like