import string import matplotlib.pyplot as plt import numpy as np from numpy import * import sys from pylab import * if __name__ == '__main__': file = open(sys.argv[1], 'r') linesList = file.readlines() cols = linesList[0].strip().split(',') cols_num = len(cols) print cols_num-3 linesList = linesList[1:] linesList = [line.strip().split(',') for line in linesList] file.close() iters = [x[0] for x in linesList] data_loss = [] for i in range(0,cols_num): data_loss.append([x[i] for x in linesList]) fig, ax = plt.subplots(figsize=(12, 12)) color = ['r','b','g','y','r--','b--','g--','y--'] start = int(sys.argv[2])#will plot the data column[start,start+6] for i in range(start,min(start+6,cols_num)): plt.subplot(611+i-start) plt.plot(iters, data_loss[i], color[i-start],label = cols[i])#,label=$cos(x^2)$) #plt.plot(iters, data_loss[5], color[0],label = cols[5])#,label=$cos(x^2)$) #plt.plot(iters, data_loss[8], color[1],label = cols[8])#,label=$cos(x^2)$) plt.xlabel('iters') plt.ylabel('loss') plt.ylim(0, 1.0) plt.title(cols[i]) plt.legend() plt.tight_layout() savefig(sys.argv[1]+'_'+str(start)+'.png') plt.show()