一、
import numpy as np
import matplotlib.pyplot as plt
x=np.arange(0,11,1)

plt.plot(x,x2)
plt.plot(x,x
3)
plt.plot(x,x*4)
plt.legend([‘Normal’,‘Fast’,‘Faster’],loc=2,ncol=3) #ncol表示有多少列
plt.show()
matplotlib图例
matplotlib图例
二、面向对象
import numpy as np
import matplotlib.pyplot as plt
x=np.arange(0,11,1)
fig=plt.figure()
ax=fig.add_subplot(111)
plt.plot(x,x)
ax.legend([‘ax legend’])
plt.show()
matplotlib图例

相关文章:

  • 2021-11-28
  • 2021-09-02
  • 2021-05-02
  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2021-12-29
  • 2021-09-10
  • 2021-04-13
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案