<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def savefig(self, output_path, title, dpi=400, format='png', cmap=None):
 """Write the image to a file using pyplot. Parameters output_path : :obj:`str` The directory in which to place the file. title : :obj:`str` The title of the file in which to save the image. dpi : int The resolution in dots per inch. format : :obj:`str` The file format to save. Available options include .png, .pdf, .ps, .eps, and .svg. cmap : :obj:`Colormap`, optional A Colormap object fo the pyplot. """

        plt.figure()
        plt.imshow(self.data, cmap=cmap)
        plt.title(title)
        plt.axis('off')
        title_underscore = title.replace(' ', '_')
        plt.savefig(
            os.path.join(
                output_path,
                '{0}.{1}'.format(
                    title_underscore,
                    format)),
            dpi=dpi,
            format=format)