ospx.utils.plotting

Functions

create_meta_dict(title)

Create a default of meta dict which can be passed to save_figure().

save_figure(fig, extension, path, title, ...)

Save a figure object as image file.

ospx.utils.plotting.create_meta_dict(title: str) dict[str, str]

Create a default of meta dict which can be passed to save_figure().

Parameters:

title (str) – the title of the figure

Returns:

the meta dict

Return type:

Dict[str, str]

ospx.utils.plotting.save_figure(fig: Figure, extension: str, path: str | PathLike[str], title: str, meta_dict: MutableMapping[str, str]) None

Save a figure object as image file.

Parameters:
  • fig (Figure) – the Matplotlib figure object

  • extension (str) – the file extension. Determines the file format.

  • path (Union[str, os.PathLike[str]]) – the folder to save the file in

  • title (str) – image title. Will also be used as file name.

  • meta_dict (MutableMapping[str, str]) – a dict with additional meta properties. Will be passed as-is to figure.savefig()