graphinglib.SmartFigure.save#

SmartFigure.save(file_name: str | PdfPages, dpi: int | None = None, transparent: bool = False, split_pdf: bool = False) Self[source]#

Saves the SmartFigure to a file.

Parameters:
file_namestr | PdfPages

The name of the file or the PdfPages object to save the figure to. The file extension determines the format (e.g., .png, .pdf). If a PdfPages object is provided, the figure will be saved to that PDF file instead. Note that the provided PdfPages object must be opened by the user, preferably using a context manager (with PdfPages(...) as pdf:).

dpiint, optional

The resolution in dots per inch. If None, the figure’s DPI is used.

transparentbool, optional

Whether to save the figure with a transparent background. A file extension that supports transparency (e.g. .png) should be used. Defaults to False.

split_pdfbool, optional

Whether to save each subplot of the SmartFigure as a separate page in a PDF file. Defaults to False.

Returns:
Self

The same SmartFigure instance, allowing for method chaining.