def draw_scree_graph(dir_path, data_file_link, background_color, label_color, generate_eps, data):
 dimensions = len(data['coord'][3])
 props = {}
 props['title'] = ('PCoA Scree Plot (First %s dimensions)' % dimensions)
 props['ylabel'] = 'Fraction of Variance'
 props['xlabel'] = 'Principal component'
 xy_coords = {}
 x_points = [x for x in range(dimensions)]
 c_data = [(float(x) / 100.0) for x in data['coord'][3]]
 xy_coords['Variance'] = (x_points, c_data, 'o', 'r')
 cum_var = [c_data[0]]
 for ix in range((dimensions - 1)):
  cum_var.append((cum_var[ix] + c_data[(ix + 1)]))
 xy_coords['Cumulative variance'] = (x_points, cum_var, 's', 'b')
 (img_src, eps_link) = make_line_plot(dir_path, data_file_link, background_color, label_color, xy_coords=xy_coords, props=props, x_len=4.5, y_len=4.5, generate_eps=generate_eps)
 return ((IMG_SRC % img_src), eps_link)

def draw_scree_graph ( dir_path , data_file_link , background_color , label_color , generate_eps , data ) : dimensions = len ( data [ 'coord' ] [ 3 ] ) props = { } props [ 'title' ] = ( 'PCoA Scree Plot (First %s dimensions)' % dimensions ) props [ 'ylabel' ] = 'Fraction of Variance' props [ 'xlabel' ] = 'Principal component' xy_coords = { } x_points = [ x for x in range ( dimensions ) ] c_data = [ ( float ( x ) / 100.0 ) for x in data [ 'coord' ] [ 3 ] ] xy_coords [ 'Variance' ] = ( x_points , c_data , 'o' , 'r' ) cum_var = [ c_data [ 0 ] ] for ix in range ( ( dimensions - 1 ) ) : cum_var . append ( ( cum_var [ ix ] + c_data [ ( ix + 1 ) ] ) ) xy_coords [ 'Cumulative variance' ] = ( x_points , cum_var , 's' , 'b' ) ( img_src , eps_link ) = make_line_plot ( dir_path , data_file_link , background_color , label_color , xy_coords = xy_coords , props = props , x_len = 4.5 , y_len = 4.5 , generate_eps = generate_eps ) return ( ( IMG_SRC % img_src ) , eps_link )
draw scree plot .