matplotlib label doesn't work

前端 未结 1 947
长发绾君心
长发绾君心 2020-12-29 03:05

When I execute the following code, it doesn\'t produce a plot with a label.

import matplotlib.pyplot as plt
import numpy as np
x = np.arange(1, 5)
plt.pl         


        
相关标签:
1条回答
  • 2020-12-29 03:41

    You forgot to display the legend:

    ...
    plt.legend(loc='best')
    plt.show()
    

    enter image description here

    0 讨论(0)
提交回复
热议问题