slmsuite.configure_plotting#

configure_plotting(mode='show', save_dir=None, headless=False, extension='png', savefig_kwargs=None)[source]#

Configure how slmsuite plots are displayed or saved.

Parameters:
  • mode (str or callable) –

    One of:

    "show"

    Pass through to plt.show() (default).

    "suppress"

    Close all figures silently.

    "save"

    Save figures to save_dir (using extension and savefig_kwargs), then close.

    callable

    Called in place of plt.show(), though it must also accept name= which is used to identify the plot.

  • save_dir (str or path-like, optional) – Output directory for "save" mode. Created if absent. The filename stem comes from the name passed to _slmsuite_plt_show() (falling back to "fig").

  • headless (bool, optional) – Switch to the "Agg" backend and call plt.ioff(). Selecting any other matplotlib backend is left to the user (e.g. the MPLBACKEND environment variable or a Jupyter %matplotlib magic).

  • extension (str, optional) – File extension (and thus output format) for "save" mode, e.g. "png" (default), "pdf", or "svg". Ignored for other modes.

  • savefig_kwargs (dict, optional) – Extra keyword arguments forwarded to Figure.savefig in "save" mode, merged over the defaults {"dpi": 150, "bbox_inches": "tight"} (user keys take precedence). Ignored for other modes.