pygmt.Figure.savefig

Figure.savefig(self, fname, transparent=False, crop=True, anti_alias=True, show=False, **kwargs)[source]

Save the figure to a file.

This method implements a matplotlib-like interface for psconvert.

Supported formats: PNG (.png), JPEG (.jpg), PDF (.pdf), BMP (.bmp), TIFF (.tif), EPS (.eps), and KML (.kml). The KML output generates a companion PNG file.

You can pass in any keyword arguments that psconvert accepts.

Parameters:
fname : str

The desired figure file name, including the extension. See the list of supported formats and their extensions above.

transparent : bool

If True, will use a transparent background for the figure. Only valid for PNG format.

crop : bool

If True, will crop the figure canvas (page) to the plot area.

anti_alias: bool

If True, will use anti aliasing when creating raster images (PNG, JPG, TIf). More specifically, uses options Qt=2, Qg=2 in psconvert. Ignored if creating vector graphics. Overrides values of Qt and Qg passed in through kwargs.

show: bool

If True, will open the figure in an external viewer.

dpi : int

Set raster resolution in dpi. Default is 720 for PDF, 300 for others.