Work needs to observe the trend of data changes, with Python to write a small program to display simple charts, to share the convenience of people with the same needs, matplotlib is a very good library.
#!encode=utf8 fromMatplotlibImportPyplot as PltImportSysignore_num= (int) (sys.argv[1]) Data=sys.argv[2]show_type=0ifLen (SYS.ARGV) >3: Show_type= (int) (sys.argv[3]) x=[]valid_ppl=[]train_ll=[]valid_ll=[]fi=open (data,"R") Line=Fi.readline () n=0 whileLine :ifLine.find ("Values") >=0:arr=line.split (" ")N+=1ifN>ignore_num:x.append (n) train_ll.append (arr[6]) valid_ll.append (arr[8]) valid_ppl.append (arr[9]) line=Fi.readline ()ifshow_type==0:plt.plot (X,train_ll,color="Blue", label="Train_ll") Plt.plot (X,valid_ll,color="Red", label="Valid_ll") Plt.plot (X,valid_ppl,color="Orange", label="VALID_PPL")elifShow_type==1: Plt.plot (X,train_ll,color="Blue", label="Train_ll") Plt.plot (X,valid_ll,color="Red", label="Valid_ll")Else: Plt.plot (X,valid_ppl,color="Orange", label="VALID_PPL") plt.legend (Loc='Upper Right') plt.show ()
To run a program using the CMD command window
Operation Result:
Reference: http://www.scipy-lectures.org/intro/matplotlib/matplotlib.html This page has written the detailed usage of pyplot, and how to draw a richer graph with Python, is a very good learning material.
Python: Drawing a chart using Matplotlib's Pyplot