ibfoamrig.plot.finish_figure#

ibfoamrig.plot.finish_figure(figure, *, show=False, save=None, close=True, **savefig_kwargs)[source]#

Shows and/or saves a figure, then closes it.

If both show and save are set, the figure is saved after the window is closed, keeping the view rotated or zoomed to.

Parameters:
  • figure (Figure) – The figure to finish. To be shown, it must be managed by pyplot.

  • show (bool) – If True, opens an interactive window and blocks until it is closed. Shows any other open pyplot figures.

  • save (StrPath | None) – Output file. Missing parent directories are created. If None nothing is saved.

  • close (bool) – If True, the figure is closed after saving to free memory.

  • **kwargs – Passed to matplotlib.figure.Figure.savefig.

Returns:

The path the figure was saved to, or None if it was now saved.

Raises:
  • RuntimeError – If show is True but the active matplotlib backend cannot open windows.

  • ValueError – If show is True but the figure is not managed by pyplot.

Return type:

Path | None