pygmt.Figure.savefig

Figure.savefig(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 pygmt.Figure.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 pygmt.Figure.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, TIFF). More specifically, it passes arguments t2 and g2 to the anti_aliasing parameter of pygmt.Figure.psconvert. Ignored if creating vector graphics.

  • 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].

  • **kwargs (dict) – Additional keyword arguments passed to pygmt.Figure.psconvert. Valid parameters are gs_path, gs_option, resize, bb_style, and verbose.