save_graphic

Plotter.save_graphic(filename, title='PyVista Export', raster=True, painter=True)

Save a screenshot of the rendering window as a graphic file.

This can be helpful for publication documents.

The supported formats are:

  • '.svg'

  • '.eps'

  • '.ps'

  • '.pdf'

  • '.tex'

Parameters
filenamestr

Path to fsave the graphic file to.

titlestr, optional

Title to use within the file properties.

rasterbool, optional

Attempt to write 3D properties as a raster image.

painterbool, optional

Configure the exporter to expect a painter-ordered 2D rendering, that is, a rendering at a fixed depth where primitives are drawn from the bottom up.

Examples

>>> import pyvista
>>> from pyvista import examples
>>> pl = pyvista.Plotter()
>>> _ = pl.add_mesh(examples.load_airplane(), smooth_shading=True)
>>> _ = pl.add_background_image(examples.mapfile)
>>> pl.save_graphic("img.svg")