From ae499204657a841a469e73c6adb9bc0df6eab7a0 Mon Sep 17 00:00:00 2001 From: NicolasBSN Date: Wed, 1 Mar 2017 19:51:06 +0100 Subject: [PATCH] =?UTF-8?q?Update=20Bar=5FChart=20+=20R=C3=A9cup=5Fmat.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parties/Bar_Chart + Récup_mat.py | 64 ++++++++++++-------------------- 1 file changed, 24 insertions(+), 40 deletions(-) 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")