show_and_save_plot
- hybrid_learning.experimentation.exp_eval_common.show_and_save_plot(fig=None, save_as=None, show_fig=True, default_fn=None, allowed_endings=('.png', '.pdf', '.svg'))[source]
Save a plot with proper default timestamped filename.
- Parameters
fig (Optional[Figure]) – the figure to plot, defaults to
plt.gcf()
save_as (Optional[str]) – the file path or directory path under which to save the figure; if save_as is a directory, the default_fn is used to create the file name; may contain the formatting key
{default}
which is then replaced bydefault_fn
(with file ending!), and{ts}
which is replaced by a timestampshow_fig (bool) – whether to call
show()
on the figuredefault_fn (Optional[str]) – the default file name (with .pdf as default file ending)
allowed_endings (Sequence[str]) – if
save_as
does not end in one ofallowed_endings
, it is assumed to be the file name and".pdf"
is appended