Recover#
- spylt.recover.recover(path: str | Path) tuple[function, dict[str, Any]][source]#
Recover the necessary data and metadata to regenerate a
spylt.SpyllingFiguresaved at path.- Parameters:
- path
Path where to find the metadata to recover.
- Returns:
- fun
Function that generated the figure to recover.
- data
Dictionary to feed fun to regenerate the figure.
Examples
You can regenerate the exact same figure:
>>> fun, data_dict = spylt.recover("figure") >>> fun(**data_dict)
You can also inspect the function’s definition to then tweak its definition:
>>> import inspect >>> print(inspect.getsource(fun))
and / or change the value of a parameter before replotting. Let’s say the colormap was an argument of fun and we wish to change it to “viridis”:
>>> fun, data_dict = spylt.recover("figure") >>> data_dict["cmap"] = "viridis" >>> fun(**data_dict)
- spylt.recover.recover_data(path: str | Path) dict[str, Any][source]#
Recover the data necessary to regenerate a
spylt.SpyllingFiguresaved at path.- Parameters:
- path
Path where to find the metadata to recover.
- Returns:
- data
Dictionary to feed fun to regenerate the plot.
- spylt.recover.recover_fun(path: str | Path) function[source]#
Recover the function necessary to regenerate a
spylt.SpyllingFiguresaved at path.- Parameters:
- path
Path where to find the metadata to recover.
- Returns:
- fun
Function that generated the plot to recover.
- spylt.recover.recover_rcParams(path: str | Path) RcParams[source]#
Recover the rcParams that were set when a
spylt.SpyllingFigurewas saved at path.- Parameters:
- path
Path where to find the metadata to recover.
- Returns:
- rcParams
The matplotlib’s rcParams that were set when the figure was saved.