import matplotlib.pyplot as plt def make_plot(fname, id): with open(fname, 'r') as f: lines = [line.rstrip() for line in f] ax1 = [] ax2 = [] ax3 = [] cnt = 0 for l in lines: b = l.split("\t") args = b[1].split(",") ax1.append([cnt, args[0]]) ax2.append([cnt, args[1]]) ax3.append([cnt, args[2]]) cnt += 1 ax1 = [list(i) for i in zip(*ax1)] ax2 = [list(i) for i in zip(*ax2)] ax3 = [list(i) for i in zip(*ax3)] plt.figure(figsize=(20,10)) plt.title("акселерометр кровати %s" % id, fontsize=20) plt.plot(ax1[0], ax1[1],'g-') plt.plot(ax2[0], ax2[1],'r-') plt.plot(ax3[0], ax3[1],'b-') img_name = "%s_chart.png" % fname plt.savefig(img_name) return(img_name) fname = './tmp/sb_2' id = 2 img_file = make_plot(fname, id) print(img_file)