savefig#
- class savefig(filename=None, comments=None, fig=None, **kwargs)[source]#
Wrapper for Matplotlib’s
pl.savefig()
function which automatically stores Covasim metadata in the figure.By default, saves (git) information from both the Covasim version and the calling function. Additional comments can be added to the saved file as well. These can be retrieved via
cv.get_png_metadata()
(orsc.loadmetadata
). Metadata can also be stored for PDF, but cannot be automatically retrieved.- Parameters:
filename (str/list) – name of the file to save to (default, timestamp); can also be a list of names
comments (str/dict) – additional metadata to save to the figure
fig (fig/list) – figure to save (by default, current one); can also be a list of figures
kwargs (dict) – passed to
fig.savefig()
Example:
cv.Sim().run().plot() cv.savefig()