Saving figures to disk#
To save a figure to disk, the save
method should be called on the figure after creation. Saving figures is available for one and two-dimensional figures. Possible file formats are .png
, .pdf
, .jpg
, and .svg
.
[1]:
import plopp as pp
da1d = pp.data.data1d()
f1d = pp.plot(da1d)
f1d
[1]:
[2]:
f1d.save('fig.png')
A note on widgets#
When using the interactive plotting backend %matplotlib widget
, a toolbar with buttons is displayed next to the figure in the notebook. These buttons will not be included when saving the figure to disk, only the graphics will make it to the file.
[3]:
%matplotlib widget
da2d = pp.data.data2d()
f2d = pp.plot(da2d)
f2d
[3]:
[4]:
f2d.save('fig2d.pdf')
Saving 3D scatter plots#
New in version 23.02.0.
It also possible to save three-dimensional scatter plots to a standalone .html
file.
[5]:
f3d = pp.scatter3d(pp.data.scatter(), pos='position', cbar=True)
f3d.save('fig3d.html')
Saving three-dimensional scatter plots to static (e.g. .png
images) is currently not implemented. We recommend to take a static screenshot of the figure.