why do we use plt.legend() ?
Use of plt.legend()
hey @muditarya31 ,
while we plot more than 1 number of lines on a matplotlib plot , the module understands and make them with different colors to help in distinguish.
But , there are many lines assume 5 ,then even with different colors we don’t know which color responds to which value.
Hence, for this we use plt.legend() . It creates a small rectangle showing what color line is used for which value.
I hope this would have helped you understand plt.legend()
Thank You and Happy Learning
.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.