lib/matplotlib/figure.py
def savefig(self, *args, **kwargs):
        """
        call signature::

          savefig(fname, dpi=None, facecolor='w', edgecolor='w',
                  orientation='portrait', papertype=None, format=None,
                  transparent=False):

        Save the current figure.

        The output formats available depend on the backend being used.

        Arguments:

          *fname*:
            A string containing a path to a filename, or a Python file-like object,
            or possibly some backend-dependent object such as
            :class:`~matplotlib.backends.backend_pdf.PdfPages`.

            If *format* is *None* and *fname* is a string, the output
            format is deduced from the extension of the filename. If
            the filename has no extension, the value of the rc parameter
            ``savefig.extension`` is used. If that value is 'auto',
            the backend determines the extension.

            If *fname* is not a string, remember to specify *format* to
            ensure that the correct backend is used.

        Keyword arguments:

          *dpi*: [ None | scalar > 0 ]
            The resolution in dots per inch.  If *None* it will default to
            the value ``savefig.dpi`` in the matplotlibrc file.

          *facecolor*, *edgecolor*:
            the colors of the figure rectangle

          *orientation*: [ 'landscape' | 'portrait' ]
            not supported on all backends; currently only on postscript output

          *papertype*:
            One of 'letter', 'legal', 'executive', 'ledger', 'a0' through
            'a10', 'b0' through 'b10'. Only supported for postscript
            output.

          *format*:
            One of the file extensions supported by the active
            backend.  Most backends support png, pdf, ps, eps and svg.

          *transparent*:
            If *True*, the figure patch and axes patches will all be
            transparent.  This is useful, for example, for displaying
            a plot on top of a colored background on a web page.  The
            transparency of these patches will be restored to their
            original values upon exit of this function.

          *bbox_inches*:
            Bbox in inches. Only the given portion of the figure is
            saved. If 'tight', try to figure out the tight bbox of
            the figure.

          *pad_inches*:
            Amount of padding around the figure when bbox_inches is
            'tight'.

          *bbox_extra_artists*:
            A list of extra artists that will be considered when the
            tight bbox is calculated.

        """

        for key in ('dpi', 'facecolor', 'edgecolor'):
            if key not in kwargs:
                kwargs[key] = rcParams['savefig.%s'%key]

        extension = rcParams['savefig.extension']
        if args and is_string_like(args[0]) and '.' not in args[0] and extension != 'auto':
            fname = args[0] + '.' + extension
            args = (fname,) + args[1:]

        transparent = kwargs.pop('transparent', False)
        if transparent:
            original_figure_alpha = self.patch.get_alpha()
            self.patch.set_alpha(0.0)
            original_axes_alpha = []
            for ax in self.axes:
                patch = ax.patch
                original_axes_alpha.append(patch.get_alpha())
                patch.set_alpha(0.0)

        self.canvas.print_figure(*args, **kwargs)

        if transparent:
            self.patch.set_alpha(original_figure_alpha)
            for ax, alpha in zip(self.axes, original_axes_alpha):
                ax.patch.set_alpha(alpha)

        call signature::

          savefig(fname, dpi=None, facecolor='w', edgecolor='w',
                  orientation='portrait', papertype=None, format=None,
                  transparent=False):

        Save the current figure.

        The output formats available depend on the backend being used.

        Arguments:

          *fname*:
            A string containing a path to a filename, or a Python file-like object,
            or possibly some backend-dependent object such as
            :class:`~matplotlib.backends.backend_pdf.PdfPages`.

            If *format* is *None* and *fname* is a string, the output
            format is deduced from the extension of the filename. If
            the filename has no extension, the value of the rc parameter
            ``savefig.extension`` is used. If that value is 'auto',
            the backend determines the extension.

            If *fname* is not a string, remember to specify *format* to
            ensure that the correct backend is used.

        Keyword arguments:

          *dpi*: [ None | scalar > 0 ]
            The resolution in dots per inch.  If *None* it will default to
            the value ``savefig.dpi`` in the matplotlibrc file.

          *facecolor*, *edgecolor*:
            the colors of the figure rectangle

          *orientation*: [ 'landscape' | 'portrait' ]
            not supported on all backends; currently only on postscript output

          *papertype*:
            One of 'letter', 'legal', 'executive', 'ledger', 'a0' through
            'a10', 'b0' through 'b10'. Only supported for postscript
            output.

          *format*:
            One of the file extensions supported by the active
            backend.  Most backends support png, pdf, ps, eps and svg.

          *transparent*:
            If *True*, the figure patch and axes patches will all be
            transparent.  This is useful, for example, for displaying
            a plot on top of a colored background on a web page.  The
            transparency of these patches will be restored to their
            original values upon exit of this function.

          *bbox_inches*:
            Bbox in inches. Only the given portion of the figure is
            saved. If 'tight', try to figure out the tight bbox of
            the figure.

          *pad_inches*:
            Amount of padding around the figure when bbox_inches is
            'tight'.

          *bbox_extra_artists*:
            A list of extra artists that will be considered when the
            tight bbox is calculated.

        


Save the current figure.

The output formats available depend on the backend being used.
Save the current figure . The output formats available depend on the backend being used .
def savefig(self, *args, **kwargs):
        for key in ('dpi', 'facecolor', 'edgecolor'):
            if key not in kwargs:
                kwargs[key] = rcParams['savefig.%s'%key]
        extension = rcParams['savefig.extension']
        if args and is_string_like(args[0]) and '.' not in args[0] and extension != 'auto':
            fname = args[0] + '.' + extension
            args = (fname,) + args[1:]
        transparent = kwargs.pop('transparent', False)
        if transparent:
            original_figure_alpha = self.patch.get_alpha()
            self.patch.set_alpha(0.0)
            original_axes_alpha = []
            for ax in self.axes:
                patch = ax.patch
                original_axes_alpha.append(patch.get_alpha())
                patch.set_alpha(0.0)
        self.canvas.print_figure(*args, **kwargs)
        if transparent:
            self.patch.set_alpha(original_figure_alpha)
            for ax, alpha in zip(self.axes, original_axes_alpha):
                ax.patch.set_alpha(alpha)
def savefig ( self , * args , ** kwargs ) : for key in ( 'dpi' , 'facecolor' , 'edgecolor' ) : if key not in kwargs : kwargs [ key ] = rcParams [ 'savefig.%s' % key ] extension = rcParams [ 'savefig.extension' ] if args and is_string_like ( args [ 0 ] ) and '.' not in args [ 0 ] and extension != 'auto' : fname = args [ 0 ] + '.' + extension args = ( fname , ) + args [ 1 : ] transparent = kwargs . pop ( 'transparent' , False ) if transparent : original_figure_alpha = self . patch . get_alpha ( ) self . patch . set_alpha ( 0.0 ) original_axes_alpha = [ ] for ax in self . axes : patch = ax . patch original_axes_alpha . append ( patch . get_alpha ( ) ) patch . set_alpha ( 0.0 ) self . canvas . print_figure ( * args , ** kwargs ) if transparent : self . patch . set_alpha ( original_figure_alpha ) for ax , alpha in zip ( self . axes , original_axes_alpha ) : ax . patch . set_alpha ( alpha )
call signature::
savefig(fname, dpi=None, facecolor='w', edgecolor='w',
orientation='portrait', papertype=None, format=None,
transparent=False):
call signature :: savefig ( fname dpi = None facecolor = ' w ' edgecolor = ' w ' orientation = ' portrait ' papertype = None format = None transparent = False ) :
"""
        call signature::

          savefig(fname, dpi=None, facecolor='w', edgecolor='w',
                  orientation='portrait', papertype=None, format=None,
                  transparent=False):

        Save the current figure.

        The output formats available depend on the backend being used.

        Arguments:

          *fname*:
            A string containing a path to a filename, or a Python file-like object,
            or possibly some backend-dependent object such as
            :class:`~matplotlib.backends.backend_pdf.PdfPages`.

            If *format* is *None* and *fname* is a string, the output
            format is deduced from the extension of the filename. If
            the filename has no extension, the value of the rc parameter
            ``savefig.extension`` is used. If that value is 'auto',
            the backend determines the extension.

            If *fname* is not a string, remember to specify *format* to
            ensure that the correct backend is used.

        Keyword arguments:

          *dpi*: [ None | scalar > 0 ]
            The resolution in dots per inch.  If *None* it will default to
            the value ``savefig.dpi`` in the matplotlibrc file.

          *facecolor*, *edgecolor*:
            the colors of the figure rectangle

          *orientation*: [ 'landscape' | 'portrait' ]
            not supported on all backends; currently only on postscript output

          *papertype*:
            One of 'letter', 'legal', 'executive', 'ledger', 'a0' through
            'a10', 'b0' through 'b10'. Only supported for postscript
            output.

          *format*:
            One of the file extensions supported by the active
            backend.  Most backends support png, pdf, ps, eps and svg.

          *transparent*:
            If *True*, the figure patch and axes patches will all be
            transparent.  This is useful, for example, for displaying
            a plot on top of a colored background on a web page.  The
            transparency of these patches will be restored to their
            original values upon exit of this function.

          *bbox_inches*:
            Bbox in inches. Only the given portion of the figure is
            saved. If 'tight', try to figure out the tight bbox of
            the figure.

          *pad_inches*:
            Amount of padding around the figure when bbox_inches is
            'tight'.

          *bbox_extra_artists*:
            A list of extra artists that will be considered when the
            tight bbox is calculated.

        """
self
*fname*
A string containing a path to a filename, or a Python file-like object,
or possibly some backend-dependent object such as
:class:`~matplotlib.backends.backend_pdf.PdfPages`.

If *format* is *None* and *fname* is a string, the output
format is deduced from the extension of the filename. If
the filename has no extension, the value of the rc parameter
``savefig.extension`` is used. If that value is 'auto',
the backend determines the extension.

If *fname* is not a string, remember to specify *format* to
ensure that the correct backend is used.
A string containing a path to a filename or a Python file - like object or possibly some backend - dependent object such as : class : ` ~matplotlib . backends . backend_pdf . PdfPages ` . If * format * is * None * and * fname * is a string the output format is deduced from the extension of the filename . If the filename has no extension the value of the rc parameter ` ` savefig . extension ` ` is used . If that value is ' auto ' the backend determines the extension . If * fname * is not a string remember to specify * format * to ensure that the correct backend is used .