#NEWLINE# def draw( self ) : #NEWLINE# #INDENT# filtered_windows = self . filter_windows ( self . sliding ) #NEWLINE# times = [ self . relative ( 'mean' , w ) for w in filtered_windows ] #NEWLINE# win_boundaries = [ ( max ( self . relative ( 'start' , w ) , self . relative ( 'start' , self . current ) ) , min ( self . relative ( 'end' , w ) , self . relative ( 'end' , self . current ) ) ) for w in filtered_windows ] #NEWLINE# similarities = np . array ( [ w . obj for w in self . filter_windows ( self . similarity ) ] ) #NEWLINE# self . main_ax . cla ( ) #NEWLINE# if ( self . plot_rc [ 'colors' ] is not None ) : #NEWLINE# #INDENT# self . main_ax . set_color_cycle ( self . plot_rc [ 'colors' ] ) #NEWLINE# #UNINDENT# for ( t , s ) in zip ( win_boundaries , similarities ) : #NEWLINE# #INDENT# y = max ( s ) #NEWLINE# self . main_ax . plot ( t , ( y , y ) , color = self . plot_rc [ 'window_boundaries_color' ] , linewidth = self . plot_rc [ 'window_boundaries_line_width' ] ) #NEWLINE# #UNINDENT# plots = plot ( times , similarities , linestyle = '-' , marker = 'o' , markersize = self . plot_rc [ 'markersize' ] , ax = self . main_ax ) #NEWLINE# for w in self . subwindows ( self . records ) : #NEWLINE# #INDENT# if self . plot_rc [ 'print_sentences' ] : #NEWLINE# #INDENT# self . main_ax . text ( self . relative ( 'mean' , w ) , ( - 0.04 ) , w . obj . trans , horizontalalignment = 'center' , fontdict = { #NEWLINE# #INDENT# 'color' : ( 'black' if self . is_test ( w . obj ) else 'gray' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . main_ax . xaxis . labelpad = 12 #NEWLINE# #UNINDENT# if self . plot_rc [ 'draw_sentence_boundaries' ] : #NEWLINE# #INDENT# self . draw_vertical_line ( self . relative ( 'end' , w ) ) #NEWLINE# #UNINDENT# #UNINDENT# legend ( plots , self . example_labels , ax = self . main_ax ) #NEWLINE# self . main_ax . set_xbound ( self . relative ( 'start' , self . current ) , self . relative ( 'end' , self . current ) ) #NEWLINE# self . main_ax . set_xlabel ( 'Time (s)' ) #NEWLINE# self . main_ax . set_ylabel ( 'Similarity (cosine)' ) #NEWLINE# self . fig . canvas . draw_idle ( )