1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| import matplotlib import matplotlib.pyplot as plt import numpy as np
x1=[1,2,3] x2=[2,3,4] x3=[3,4,5] x4=[4,5,6] y1=[2,5,7] y2=[4,5,8] y3=[5,7,9] y4=[1,5,0] plt.plot(x3,y3,linewidth =3.0, label = '第一个线名字',color='#F27970', linestyle='-',marker=",")
plt.plot(x2,y2,linewidth =3.0, label = '第二个线名字',color='#00CC96', linestyle='-',marker=",") plt.plot(x4,y4,linewidth =3.0, label = '第三个线名字,color=' plt.plot(x1,y1,linewidth =3.0, label = '第四个线名字',color='#8983BF', linestyle='-',marker=",") plt.xlabel("generation") plt.ylabel("fitness") plt.title("Ant") spines[:].set_visible(False) plt.legend() plt.savefig('myplot.pdf') plt.show()
|