solarwindpy.plotting.tools.save

save(fig, spath, add_info=True, info_x=0, info_y=0, log=True, pdf=True, png=True, **kwargs)[source]

Save a figure in both PDF and PNG formats.

Parameters:
  • fig (matplotlib.figure.Figure or matplotlib.axes.Axes) – The figure or axis to save.

  • spath (pathlib.Path) – Base path for the output files. The appropriate extension will be added automatically.

  • add_info (bool, optional) – If True, add an attribution and timestamp to the bottom left of the PNG version.

  • info_x (float, optional) – X-position of the attribution text in figure coordinates.

  • info_y (float, optional) – Y-position of the attribution text in figure coordinates.

  • log (bool, optional) – If True, write information about the saved files to alog.

  • pdf (bool, optional) – Save a PDF version of the figure.

  • png (bool, optional) – Save a PNG version of the figure.

  • **kwargs – Additional keyword arguments passed to Figure.savefig().

Return type:

None

Examples

>>> fig, ax = subplots()
>>> save(fig, Path('my_plot'))