# data_dict = { #Time q32 q34 q42 q44 rtouch1 rtouch2 rtouch3 rtouch4 ltouch1 ltouch2 ltouch3 # ltouch4 vec_hip_lx vec_knee_lx vec_hip_rx vec_knee_rx acc_hip_lx_angle acc_knee_lx_angle # acc_hip_rx_angle acc_knee_rx_angle # # 'Time':[], # 'q32':[], # } import time import matplotlib.pyplot as plt fig= plt.subplot() def data_dictionary (path,data_dict = {}): data = open(path,'r',encoding= 'utf-8') for line in data : #print(line) line_list = line.strip().split('\t') print(line_list) for item in line_list: data_dict[item] = [] colum_name = line_list #print('111111111111111111111111111', data_dict) break for line in data : line_list = line.strip().split('\t') #print(line_list) for i in range(len(line_list)): # print(colum_name[i]) #print(line_list[i]) data_dict[colum_name[i]].append(float(line_list[i])) #print(data_dict) #data_dict[str(colum_name[i])].append(line_list[i]) #print(i) return data_dict def drawing_pitcure (path,x_axis,*args): data_dict= data_dictionary(path) for item in args: if item in data_dict.keys(): fig.plot(data_dict[x_axis],data_dict[item]) print('x_axis',data_dict[x_axis]) print('data_dict',data_dict[item]) else : print('there is no this variable') plt.show() data_dict = data_dictionary(r'C:\Users\LENOVO\Desktop\python\juemi\0411\OutputAngles3.xls') drawing_pitcure(r'C:\Users\LENOVO\Desktop\python\juemi\0411\OutputAngles3.xls','Time','ltouch2','rtouch3')