import numpy as np import matplotlib.pyplot as plt import sys if (not len(sys.argv) == 3): print("Please give the data file as the first argument and the separator as the second argument to this program") sys.exit() file_name = sys.argv[1] if sys.argv[2] == "comma": separator = "," elif sys.argv[2] == "space": separator = " " elif sys.argv[2] == "tab": separator = "\t" elif sys.argv[2] == "pipe": separator = "|" else: print("not known separator! please choose one of {comma, space, tab, pipe}") exit(0); data = np.loadtxt(file_name, delimiter = separator) plt.figure() plt.plot(data[:,0], data[:,1], '-bo') if (np.shape(data)[1] == 3): plt.plot(data[:,0], data[:,1]/data[:,2]*100.0, '-r', linewidth=4) plt.legend(['Series','Analytical value'], loc = 4) plt.grid() plt.xlabel("i") plt.ylabel("value") plt.show()