Please help error related to legend

Hi all,

I’m trying to create a Multiple Line in PyPlot. It gives error like attached picture.

This returns the following error:
No handles with labels found to put in legend.

1 Like

dear vancan.

I met you again.

It’s a very simple error.

ax1.plot(df.Year, df.Car, ‘O-’)
ax1.plot(df.Year, df.Phone, ‘S-’)
ax1.plot(df.Year, df.TV, ‘*-’)
ax.plot(df.Year, df.Computer, ‘X–’)


ax1.plot(df.Year, df.Car, ‘O-’, label=‘Car’)
ax1.plot(df.Year, df.Phone, ‘S-’, label=‘Phone’)
ax1.plot(df.Year, df.TV, ‘*-’, label=‘TV’)
ax.plot(df.Year, df.Computer, ‘X–’, label=‘Computer’)

Then the legend will be displayed.

see you.