Add "Afficher_as_txt"

This commit is contained in:
Paul-Corbalan 2020-04-29 09:12:03 +02:00
parent 41d4f96e8a
commit 50cbfce858
1 changed files with 18 additions and 3 deletions

View File

@ -24,6 +24,22 @@ def Afficher_Array(y):
print("") print("")
def Afficher_as_txt(y):
space = ' ' # <--- Pour modifier les espaces
plein = '#'
vide = ' '
N1 = len(y)
for i in range(N1):
N2 = len(y[i])
for j in range(N2):
if y[i][j]:
print(plein, end=space)
else:
print(vide, end=space)
print("")
def Print_plt(Mat, fichier, rep=".\\", afficher=False, save=True): def Print_plt(Mat, fichier, rep=".\\", afficher=False, save=True):
x = [] x = []
y = [] y = []
@ -37,9 +53,8 @@ def Print_plt(Mat, fichier, rep=".\\", afficher=False, save=True):
if Mat[i][j]: if Mat[i][j]:
x.append(j) x.append(j)
y.append(N1-i) y.append(N1-i)
plt.scatter(x, y, color=c, label=fichier, s=size, marker=mk) plt.scatter(x, y, color=c, s=size, marker=mk)
plt.title("Simulation de foudre") plt.title(fichier)
plt.legend(loc='upper left')
plt.axis([0, N1, 0, N2]) plt.axis([0, N1, 0, N2])
if save: if save:
plt.savefig(rep+fichier+".png") plt.savefig(rep+fichier+".png")