加入標籤
如果我們把沒有任何標籤的圖表交給 Deshaun 警官的主管,她不會知道每條線代表什麼。
我們需要在 Deshaun 警官的工時折線圖上加入標籤。
本練習屬於課程
Python 的資料科學入門
練習說明
- 為圖表加入一個有意義的標題。
- 為 y 軸加入標籤。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Lines
plt.plot(deshaun.day_of_week, deshaun.hours_worked, label='Deshaun')
plt.plot(aditya.day_of_week, aditya.hours_worked, label='Aditya')
plt.plot(mengfei.day_of_week, mengfei.hours_worked, label='Mengfei')
# Add a title
plt.____(____)
# Add y-axis label
plt.____(____)
# Legend
plt.legend()
# Display plot
plt.show()