diff --git a/parties/Bar_Chart + Récup_mat.py b/parties/Bar_Chart + Récup_mat.py index b02a47b..173145e 100644 --- a/parties/Bar_Chart + Récup_mat.py +++ b/parties/Bar_Chart + Récup_mat.py @@ -33,66 +33,50 @@ def bar_chart(): matGain=recup_mat(matrice,'annees_de_prison') #initialisation des paramètres - - strat0=0 + #list gain + gain=[] + #list strat + strat=[] - strat1=0 - - strat2=0 - - strat3=0 - - strat4=0 - - strat5=0 - - gain0=0 - - gain1=0 - - gain2=0 - - gain3=0 - - gain4=0 - - gain5=0 + for i range (6): + gain[i]=0 + strat[i]=0 + gain.append(gain[i]) + strat.append(strat[i]) + for ligne in range (0,TailleGrilleX): for colonne in range(0, TailleGrilleY): if matStrat[ligne,colonne]==0: - strat0=strat0+1 - gain0=gain0+matGain[ligne,colonne] + strat[i]=strat[i]+1 + gain[i]=gain[i]+matGain[ligne,colonne] elif matStrat[ligne,colonne]==1: - strat1=strat1+1 - gain1=gain1+matGain[ligne,colonne] + strat[i]=strat[i]+1 + gain[i]=gain[i]+matGain[ligne,colonne] elif matStrat[ligne,colonne]==2: - strat2=strat2+1 - gain2=gain2+matGain[ligne,colonne] + strat[i]=strat[i]+1 + gain[i]=gain[i]+matGain[ligne,colonne] elif matStrat[ligne,colonne]==3: - strat3=strat3+1 - gain3=gain3+matGain[ligne,colonne] + strat[i]=strat[i]+1 + gain[i]=gain[i]+matGain[ligne,colonne] elif matStrat[ligne,colonne]==4: - strat4=strat4+1 - gain4=gain4+matGain[ligne,colonne] + strat[i]=strat[i]+1 + gain[i]=gain[i]+matGain[ligne,colonne] else : - strat5=strat5+1 - gain5=gain5+matGain[ligne,colonne] + strat[i]=strat[i]+1 + gain[i]=gain[i]+matGain[ligne,colonne] Strat=('1','2', '3','4' ,'5','6') x_pos = np.arange(len(Strat)) - - gain=[gain0,gain1,gain2,gain3,gain4,gain5] - - - + + plt.bar(x_pos, gain, align='center', color='b' ) plt.xlabel("Stratégies")