pydox.figures.commit#
- figures.commit(fig: Figure, name: str, category: str | None = None, watermark: str | None = None, config_uid: str | None = None, dest: Path | None = None) PydoxFigure#
Commit a named
matplotlib.figure.Figureobject to the global registry of figuresThis function is to be called from anywhere in the library.
A commit is the following set of operations:
create a new
pydox.commodities.PydoxFigureinstance and append it to the global registry if not already there,print a watermark on each axes of the figure (if setting plots.watermark.show is set to True),
save the
matplotlib.figure.Figureobject on a temporary pickle file,close the
matplotlib.figure.Figureobject (show or save is managed elsewhere using the global registry).
Use the registry to report/show figures matching some criteria based on meta-data filtering.
- Parameters:
fig (
matplotlib.figure.Figure) – Thematplotlib.figure.Figureinstance to commit.name (str) – The string name given to the figure.
category (str, default=None) – The figure category to assign to this figure. Possible values are given in
pydox.commodities.VALID_FIGURE_CATEGORIES.watermark (str, default = None) – If the plots.watermark.show setting is True, print this watermark on the figure. Note that the default watermark (from plots.watermark.default setting) is always added, even if this argument is None.
config_uid (str, default=None) – The unique configuration ID to associate this figure with. This is typically a configuration UID, as return by
pydox.calibration.spec.Workflow.uid().dest (Optional[Path]) – Destination folder of the figure pickle file. Default path is given by
pydox.tmp_root(). Note that this is not the report output path, this path is likely temporary.