import matplotlib.pyplot as plt

class Graph():
    def __init__(self, xdata, ydata):
        self.fig, self.ax = plt.subplots()
        self.line, = self.ax.plot(xdata, ydata)

    def update_graph(self, xdata, ydata):
        self.line.set_data(xdata, ydata)
        self.ax.relim()
        self.ax.autoscale_view()
        self.fig.canvas.draw()
