'whole procces on one picture in the GUI

I want to show on GUI the hole process but in one picture, right now I got every phase of the loop on an individual picture and cannot figure out how to solve it. Thanks in advance for the answer.

Here is the def what plot the process on the GUI

def draw(data):
    fig,a = plt.subplots()
    df2 = DataFrame(data)
    figure2 = plt.Figure(figsize=(1, 1), dpi=100)
    ax2 = figure2.add_subplot(111)
    line2 = FigureCanvasTkAgg(figure2, root)
    line2.get_tk_widget().pack(side=LEFT, fill=BOTH)
    df2.plot(kind='line', legend=True, ax=ax2, fontsize=10)
    plt.close(fig)

And there is where I wanna call it

def calc(numbers):
    n=int(korok.get())
    P=np.dot(numbers,numbers)
    for i in range(n):
        P=np.dot(P,numbers)
        draw(P)
        np.set_printoptions(precision=3)
        print(P)

    label = Label(root, text=str(P),font=("Arial", 15)).place(x=20, y=60)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source