mkt.schema.io_utils.save_plot

mkt.schema.io_utils.save_plot(fig, output_filename: str, plot_type: str = 'Plot', bool_force_local: bool = True, bool_image_subdir=True, output_path: str | None = None, bool_svg: bool = True, bool_png: bool = True, bool_pdf: bool = False, **kwargs) None[source]

Save the current matplotlib figure in the requested vector/raster formats.

Parameters:

figmatplotlib.figure.Figure

The figure object to save.

output_filenamestr

Name of the output file to save the plot. Any extension is stripped; the format suffixes are appended per the bool_svg/bool_png/bool_pdf flags.

plot_typestr

Description of the plot type for logging purposes (e.g., “Dynamic range plot”)

bool_force_localbool

If True, forces saving to the local dir (repo root or cwd) regardless of env var; default is True.

bool_image_subdirbool

If True, saves images to a subdirectory named “images” within the output path; default is True.

output_pathstr | None

Optional path to save the plot. If None, saves to the current working directory.

bool_svgbool

If True, write an SVG copy; default is True.

bool_pngbool

If True, write a PNG copy; default is True.

bool_pdfbool

If True, write a PDF copy; default is False.

**kwargs

Additional keyword arguments to pass to plt.savefig (e.g., {“dpi”: 300}). Default is empty dict.