Answers for "plt.legend example"

1

matplotlib add legend axis x

fig = plt.figure(figsize=(10,5))
ax = fig.add_subplot(111)
ax.set_title('ADR vs Rating (CS:GO)')
ax.scatter(x=data[:,0],y=data[:,1],label='Data')
plt.plot(data[:,0], m*data[:,0] + b,color='red',label='Our Fitting 
Line')
ax.set_xlabel('ADR')
ax.set_ylabel('Rating')
ax.legend(loc='best')
plt.show()
Posted by: Guest on June-04-2020
3

plt.legend(

plt.legend(['first', 'second']);
Posted by: Guest on January-13-2021
0

plt legend

Official documentaion at https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.legend.html
Posted by: Guest on November-13-2021

Python Answers by Framework

Browse Popular Code Answers by Language