I'm trying to plot step graph within for loop based on input. The input interface looks like this:

if I entered the `service life = 60`, `discount rate =2`, `maintenance cost=1`,
`maintenance routine = 9`, `quality = "high"`, the total will be `3.94` after the calculate button is clicked, which is ok for me. 

[![enter image description here](https://i.stack.imgur.com/sqD97.png)](https://i.stack.imgur.com/sqD97.png)

My code as follows:

```
from tkinter import *
from tkinter import ttk
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk)
from matplotlib.figure import Figure

root = Tk()

root.title("LCAT")

var1 = StringVar()
var2 = StringVar()
var3 = StringVar()
var4 = StringVar()
var5 = StringVar()
Total = StringVar()

center_figure = Frame(root, width=500, height=500, relief=SUNKEN, bd=3)
center_figure.grid(row=7, column =1)

lblservice = Label(root, text="Service Life", bd=5).grid(row=0, column=0)
service_life = Entry(root, bd=5, textvariable=var1).grid(row=0, column=1)

lblrate = Label(root, text="Discount Rate", bd=5).grid(row=1, column=0)
discount_rate = Entry(root, bd=5, textvariable=var2).grid(row=1, column=1)

lblmaintenance = Label(root, text="Maintenance Cost", bd=5).grid(row=2, column=0)
maintenance_cost = Entry(root, bd=5, textvariable=var3).grid(row=2, column=1)

lblmaintenance_routine = Label(root, text="Maintenance Routine", bd=5).grid(row=3, column=0)
maintenance_time = Entry(root, bd=5, textvariable=var4).grid(row=3, column=1)

lblquality = Label(root, text="Quality", bd=5).grid(row=4, column=0)
cob_quality_main = ttk.Combobox(root, state='readonly', textvariable=var5)
cob_quality_main['value']=('','High','Normal','Low')
cob_quality_main.current(0)
cob_quality_main.grid(row=4, column=1)

lbltotal= Label(root, text="Total", bd=5).grid(row=5, column=0)
total_cost = Entry(root, bd=5, textvariable=Total).grid(row=5, column=1)
#------------------------------ Functions ---------------------------
def Exit():
    root.destroy()

def Maintenance():
    if (var5.get() == "High"):
        x = float(1.34)
        y = var4.get()
        z = var1.get()
        a = (float(var2.get())) / 100
        b = float(var3.get())
        ax = range(int(y), int(z), int(y))
        total = 0
        for t in ax:
            total += (0.5 + 0.5 * x * b) / (1 + a) ** t
            print(t)
            print('%0.2f' % (total))
            Total.set(str('%0.2f' % (total)))
            fig = Figure(figsize=(5, 4), dpi=100)
            fig.add_subplot(111).plot([t], [total])
            canvas = FigureCanvasTkAgg(fig, center_figure)
            canvas.draw()
            canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1, ipadx=45, ipady=30)

    elif var5.get() == "Normal":
        x = float(1.00)
        y = var4.get()
        z = var1.get()
        a = (float(var2.get())) / 100
        b = float(var3.get())
        ax = range(int(y), int(z), int(y))
        total = 0
        for t in ax:
            total += (0.5 + (0.5 * x * b)) / ((1 + a) ** t)
            print(t)
            print('%0.2f' % (t, total))
            Total.set(str('%0.2f' % (total)))
            fig = Figure(figsize=(5, 4), dpi=100)
            fig.add_subplot(111).plot([t], [total])
            canvas = FigureCanvasTkAgg(fig, center_figure)
            canvas.draw()
            canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1, ipadx=45, ipady=30)

    elif var5.get() == "Low":
        x = float(0.75)
        y = var4.get()
        z = var1.get()
        a = (float(var2.get())) / 100
        b = float(var3.get())
        ax = range(int(y), int(z), int(y))
        total = 0
        for t in ax:
            total += (0.5 + (0.5 * x * b)) / ((1 + a) ** t)
            print(t)
            print('%0.2f' % (t, total))
            Total.set(str('%0.2f' % (total)))
            fig = Figure(figsize=(5, 4), dpi=100)
            fig.add_subplot(111).plot([t], [total])
            canvas = FigureCanvasTkAgg(fig, center_figure)
            canvas.draw()
            canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1, ipadx=45, ipady=30)

btn1 = Button(root, text="Exit", bd=5, command=Exit).grid(row=6, column=0)
btn2 = Button(root, text="Calculate", bd=5, command=Maintenance).grid(row=6, column=1)

root.mainloop()

```

The x-axis of graph should be t
and the y-axis is the total

when I print t and total, the lists are correct, too. However, the graph doesn't appear on canvas and I need your help.

The graph should be like this one:
[![enter image description here](https://i.stack.imgur.com/xhlsW.png)](https://i.stack.imgur.com/xhlsW.png)