#NEWLINE# def draw_overall_chart( chess_pieces_move_dict ) : #NEWLINE# #INDENT# fig = plt . figure ( ) #NEWLINE# ax = fig . add_subplot ( 111 ) #NEWLINE# piece_color_hash = { #NEWLINE# #INDENT# 'p' : 'LightSlateGray' , #NEWLINE# 'k' : 'Navy' , #NEWLINE# 'q' : 'ForestGreen' , #NEWLINE# 'r' : 'OrangeRed' , #NEWLINE# 'n' : 'LimeGreen' , #NEWLINE# 'b' : 'red' , #NEWLINE# #UNINDENT# } #NEWLINE# ( legend , legend_text ) = ( [ ] , [ ] ) #NEWLINE# for ( i , ( piece , piece_moves ) ) in enumerate ( chess_pieces_move_dict . iteritems ( ) ) : #NEWLINE# #INDENT# piece_x = [ ] #NEWLINE# piece_y = [ ] #NEWLINE# piece_area = [ ] #NEWLINE# legend_text . append ( pieces_hash [ piece ] ) #NEWLINE# for ( locations , count ) in piece_moves . iteritems ( ) : #NEWLINE# #INDENT# piece_x . append ( locations [ 1 ] ) #NEWLINE# piece_y . append ( locations [ 0 ] ) #NEWLINE# piece_area . append ( count ) #NEWLINE# #UNINDENT# piece_area = normalize_area_vec ( piece_area ) #NEWLINE# plt . scatter ( piece_x , piece_y , alpha = 0.75 , color = piece_color_hash [ piece ] , s = piece_area ) #NEWLINE# ax . set_xticks ( range ( ( min ( piece_x ) - 1 ) , ( max ( piece_x ) + 2 ) ) ) #NEWLINE# ax . set_yticks ( range ( ( min ( legend_text ) - 1 ) , ( max ( piece_y ) + 2 ) ) ) #NEWLINE# #UNINDENT# plt . legend ( legend_text , scatterpoints = 1 , loc = 'lower center' , ncol = 6 , prop = { #NEWLINE# #INDENT# 'size' : 10 , #NEWLINE# #UNINDENT# } ) #NEWLINE# plt . scatter ( [ 0 ] , [ 0 ] , s = 180 , alpha = 0.9 , color = 'black' ) #NEWLINE# plt . grid ( b = True , which = 'both' , color = '0.65' , linestyle = '-' ) #NEWLINE# plt . show ( )