mosaicmpi.utils.save_fig

Contents

mosaicmpi.utils.save_fig#

mosaicmpi.utils.save_fig(fig: Figure, filepath_no_ext: str, target_dpi: float | None = 200, formats: str | Collection[str] = 'pdf', close: bool = True, **kwargs)#

Save figure to one or more files with the same basename. Directories are created as needed.

Parameters:
  • fig (Figure) – figure

  • basename (str) – path to filename excluding extension

  • target_dpi (float, optional) – target DPI (for PNG output only), defaults to 200

  • formats (Union[str, Collection[str]], optional) – figure extension or list of extensions. Values can be “pdf” or “png”, or (“pdf”, “png”) for both, defaults to “pdf”

  • close (bool, optional) – close figure after saving, defaults to True