使用matplotlib绘制带图例的图表

时间:2021-11-23 19:23:11
#coding=utf8

from pylab import *

plt.figure(figsize=(8,10), dpi=50)

plt.plot(do_tow2[28:508],do_prn2[28:508],do_tow5[28:508],do_prn5[28:508],do_tow6[28:508],do_prn6[28:508],do_tow9[28:508],do_prn9[28:508],do_tow10[28:508],do_prn10[28:508],do_tow12[28:508],do_prn12[28:508],do_tow13[28:508],do_prn13[28:508],do_tow17[28:508],do_prn17[28:508],do_tow25[28:508],do_prn25[28:508],do_tow26[28:508],do_prn26[28:508])

plt.legend(('PRN2','PRN5', 'PRN6', 'PRN9', 'PRN10', 'PRN12', 'PRN13', 'PRN17', 'PRN25', 'PRN26'), 'upper right')

plt.savefig("do.png")