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 :doc:psconvert </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, TIFF). More specifically, it uses options
t2, g2
in :doc:psconvert </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.