#NEWLINE# def graph_data_on_the_same_graph( list_of_plots , output_directory , resource_path , output_filename ) : #NEWLINE# #INDENT# '\n  graph_data_on_the_same_graph: put a list of plots on the same graph: currently it supports CDF\n  ' #NEWLINE# maximum_yvalue = ( - float ( 'inf' ) ) #NEWLINE# minimum_yvalue = float ( 'inf' ) #NEWLINE# plots = curate_plot_list ( list_of_plots ) #NEWLINE# plot_count = len ( plots ) #NEWLINE# if ( plot_count == 0 ) : #NEWLINE# #INDENT# return ( False , None ) #NEWLINE# #UNINDENT# ( graph_height , graph_width , graph_title ) = get_graph_metadata ( plots ) #NEWLINE# current_plot_count = 0 #NEWLINE# ( fig , axis ) = plt . subplots ( ) #NEWLINE# fig . set_size_inches ( graph_width , graph_height ) #NEWLINE# if ( plot_count < 2 ) : #NEWLINE# #INDENT# fig . subplots_adjust ( left = CONSTANTS . SUBPLOT_LEFT_OFFSET , bottom = CONSTANTS . SUBPLOT_BOTTOM_OFFSET , right = CONSTANTS . SUBPLOT_RIGHT_OFFSET ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fig . subplots_adjust ( left = CONSTANTS . SUBPLOT_LEFT_OFFSET , bottom = CONSTANTS . SUBPLOT_BOTTOM_OFFSET , right = ( CONSTANTS . SUBPLOT_RIGHT_OFFSET - ( CONSTANTS . Y_AXIS_OFFSET * ( plot_count - 2 ) ) ) ) #NEWLINE# #UNINDENT# for plot in plots : #NEWLINE# #INDENT# current_plot_count += 1 #NEWLINE# logger . info ( ( ( ( ( 'Processing: ' + plot . input_csv ) + ' [ ' ) + output_filename ) + ' ]' ) ) #NEWLINE# ( xval , yval ) = numpy . loadtxt ( plot . input_csv , unpack = True , delimiter = ',' ) #NEWLINE# axis . plot ( xval , yval , linestyle = '-' , marker = None , color = get_current_color ( current_plot_count ) , label = plot . plot_label ) #NEWLINE# axis . legend ( ) #NEWLINE# maximum_yvalue = max ( maximum_yvalue , ( numpy . amax ( yval ) * ( 1.0 + ( CONSTANTS . ZOOM_FACTOR * current_plot_count ) ) ) ) #NEWLINE# minimum_yvalue = min ( minimum_yvalue , ( numpy . amin ( yval ) * ( 1.0 - ( CONSTANTS . ZOOM_FACTOR * current_plot_count ) ) ) ) #NEWLINE# #UNINDENT# axis . yaxis . set_ticks_position ( 'left' ) #NEWLINE# axis . set_xlabel ( plots [ 0 ] . x_label ) #NEWLINE# axis . set_ylabel ( plots [ 0 ] . y_label , fontsize = CONSTANTS . Y_LABEL_FONTSIZE ) #NEWLINE# axis . set_ylim ( [ minimum_yvalue , maximum_yvalue ] ) #NEWLINE# axis . yaxis . grid ( True ) #NEWLINE# axis . xaxis . grid ( True ) #NEWLINE# axis . set_title ( graph_title ) #NEWLINE# plot_file_name = os . path . join ( output_directory , ( output_filename + '.png' ) ) #NEWLINE# fig . savefig ( plot_file_name ) #NEWLINE# plt . close ( ) #NEWLINE# with open ( os . path . join ( output_directory , ( output_filename + '.div' ) ) , 'w' ) as div_file : #NEWLINE# #INDENT# div_file . write ( ( ( ( ( ( ( ( ( ( ( '<a name="' + os . path . basename ( plot_file_name ) . replace ( '.png' , '' ) . replace ( '.diff' , '' ) ) + '"></a><div class="col-md-12"><img src="' ) + resource_path ) + '/' ) + os . path . basename ( plot_file_name ) ) + '" id="' ) + os . path . basename ( plot_file_name ) ) + '" width="100%" height="auto"/></div><div class="col-md-12"><p align=center>' ) + os . path . basename ( plot_file_name ) ) + '<br/></p></div>' ) ) #NEWLINE# #UNINDENT# return ( True , os . path . join ( output_directory , ( output_filename + '.div' ) ) )