<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def plot(self, fname=None):
 """ Plot the input data and resulting smooth. Parameters fname : str, optional name of file to produce. If none, will show interactively. """

        plt.figure()
        xy = sorted(zip(self.x, self.smooth_result))
        x, y = zip(*xy)
        plt.plot(x, y, '-')
        plt.plot(self.x, self.y, '.')
        if fname:
            plt.savefig(fname)
        else:
            plt.show()
        plt.close()