Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1.  
  2.  
  3. import matplotlib.pyplot as plt
  4.  
  5.  
  6. ''' test data below - to be changed '''
  7.  
  8.  
  9. list_1 = [1000, 1019, 1027, 1037, 1029, 1028, 1043, 1066, 1056, 1046, 1046, 1067, 1075, 1075, 1085, 1078, 1089, 1105]
  10. list_2 = [1000, 986, 992, 1001, 1007, 1004, 1009, 997, 980, 984, 974, 977, 962, 942, 923, 915, 909, 890, 867, 843, 850]
  11. list_3 = [1000, 994, 995, 986, 997, 991, 984, 990, 1012, 1023, 1031, 1021, 1046, 1043, 1066, 1060, 1077, 1096, 1097, 1092, 1089]
  12. list_4 = [1000, 990, 977, 987, 982, 967, 973, 962, 968, 975, 980, 980, 990, 987, 988, 994]
  13.  
  14. test_elo_dict = {
  15.         'Bo Hardin': list_1,
  16.         'Zack Kopstein': list_2,
  17.         'Tommy Hannan': list_3,
  18.         'Nick Charchut': list_4
  19.         }
  20.  
  21.  
  22. ''' test data above - to be changed '''
  23.  
  24.  
  25.  
  26. def elo_graph(dictionary):
  27.  
  28.    
  29.     for i in dictionary.items():
  30.        
  31.         indiv_name = i[0]
  32.         indiv_list = i[1]
  33.        
  34.         num_games = len(indiv_list)
  35.         games_list = []
  36.        
  37.         for i in range(num_games):
  38.             games_list.append(i+1)
  39.  
  40.         plt.plot(games_list, indiv_list, label = str(indiv_name) + ' - ELO: ' + str(indiv_list[-1]))
  41.        
  42.    
  43.     handles, labels = plt.gca().get_legend_handles_labels()
  44.     order = [a + " - ELO: " + str(test_elo_dict[a][-1]) for a in test_elo_dict.keys()]
  45.     order.sort(key = lambda x: -int(x[-4:]))
  46.     plt.legend(order, bbox_to_anchor=(1.01, 1), loc='upper left')
  47. #    plt.legend(bbox_to_anchor=(1.01, 1), loc='upper left')
  48.        
  49.     plt.xlabel('# Games')
  50.     plt.ylabel('ELO')  
  51.  
  52.  
  53. elo_graph(test_elo_dict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement