def plot_from_file(fname): print 'fname',fname # read data from the file data=read_data_module.readDatafrom (fname) print 'data',data # select a column col=6 col_data=[] for f in data: col_data.append(f[col]) print 'col_data',col_data # FIND THE LABELS LABELS=[] for f in data: LABELS.append(f[0]) print 'LABELS',LABELS # plot a BAR GRAPH x_len=len(col_data) ind=numpy.arange(x_len) #convert from string to int col_data = map(float, col_data) WIDTH=0.35 rects = plt.bar(ind, col_data, WIDTH) plt.xticks(ind+WIDTH/2., LABELS) plt.ylabel('y label') plt.xlabel('x label') plt.show()
def plot_from_file(fname): print 'fname', fname # read data from the file data = read_data_module.readDatafrom(fname) print 'data', data # select a column col = 6 col_data = [] for f in data: col_data.append(f[col]) print 'col_data', col_data # FIND THE LABELS LABELS = [] for f in data: LABELS.append(f[0]) print 'LABELS', LABELS # plot a BAR GRAPH x_len = len(col_data) ind = numpy.arange(x_len) #convert from string to int col_data = map(float, col_data) WIDTH = 0.35 rects = plt.bar(ind, col_data, WIDTH) plt.xticks(ind + WIDTH / 2., LABELS) plt.ylabel('y label') plt.xlabel('x label') plt.show()
for opts in sys.argv: if opts == '-help': print ' in help ' if opts == '-graph': graph = 1 print ' plot draw_graph' if opts == '-show_pts': show_pts = 1 graph_data = [] labels = [] for files in glob.glob('*.line'): fname = files #read the line file data = read_data_module.readDatafrom(fname) #print 'data 0 ',data[0] if data[0] != ['LINEC']: print 'This is not a LINEC file.' sys.exit() #num of points and lines num_points = int(data[2][0]) num_line = int(data[2][1]) # array of vertex degrees deg = [0] * num_points #print deg #find Degrees of each point for l in data[3 + num_points + 1:]:
if opts == '-help': print ' in help ' if opts =='-graph': graph=1 print ' plot draw_graph' if opts =='-show_pts': show_pts=1 graph_data=[] labels=[] for files in glob.glob('*.line'): fname=files #read the line file data=read_data_module.readDatafrom (fname) #print 'data 0 ',data[0] if data[0]!=['LINEC']: print 'This is not a LINEC file.' sys.exit() #num of points and lines num_points=int(data[2][0]) num_line=int(data[2][1]) # array of vertex degrees deg=[0]*num_points #print deg #find Degrees of each point for l in data[3+num_points+1:]: