1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
def ACP():
.
.
.
#graphique variance
# Create dataframe
df = pd.DataFrame({
'x': x,
'y':VaPtri,
'group': Variance
})
sns.regplot(data=df, x="x", y="y", fit_reg=False, marker="+", color="skyblue")
# basic plot
p1=sns.regplot(data=df, x="x", y="y", fit_reg=False, marker="o", color="skyblue")
# add annotations one by one with a loop
for line in range(0,df.shape[0]):
p1.text(df.x[line]+0.1, df.y[line], df.group[line], horizontalalignment='left', size='medium', color='black', weight='semibold')
plt.grid()
plt.xlabel('Numero de valeur propre')
plt.ylabel('Valeur propre')
plt.title('Variance accumulé')
plt.savefig(nom+'variance'+'.png')
NOM.set(nom)
plt.plot(x,VaPtri)
image = Image.open(nom+'variance'+'.png')
photo = ImageTk.PhotoImage(image)
largeur = photo.width() # dimensions en nombre de pixels
hauteur = photo.height()
zone_image = Canvas(Mafenetre, width = largeur, height = hauteur) # crée un canevas de dimensions ajustées à celles de l'image
zone_image.create_image(0,0, anchor = NW, image = photo) # association image/widget
zone_image.grid(column=0,row=10) # placement du widget
return
def graphique():
.
.
return
.
.
.
##interface
# Creation d'une fenetre principale : Main window
Mafenetre = Tk()
Mafenetre.title("ACP")
Mafenetre.geometry('120000x600')
Mafenetre.configure(bg = "white")
#bouton lancer Graphique
Frame12 = Frame(Mafenetre,borderwidth=2,relief=GROOVE,bg='gold')
Frame12.grid(rowspan=2,column= 2,row=6)
Label(Frame12,text=" Projections",bg='gold').grid(row=6, column=2)
Button(Frame12,text="Lancer",fg='navy',command=Graphique,bg='gold').grid(row=7, column=2)
#bouton lancer ACP
Frame2 = Frame(Mafenetre,borderwidth=2,relief=GROOVE,bg='deep sky blue')
Frame2.grid(rowspan=2,column=2,row=2)
Label(Frame2,text="ACP",bg='deep sky blue').grid(row=2, column=2)
Button(Frame2,text="Lancer",fg='navy',command=ACP,bg='deep sky blue').grid(row=3, column=2) |
Partager