plotly.io.write_imageΒΆ
-
plotly.io.write_image(fig, file, format=None, scale=None, width=None, height=None, validate=True, engine='auto')ΒΆ Convert a figure to a static image and write it to a file or writeable object
- Parameters
fig β Figure object or dict representing a figure
file (str or writeable) β A string representing a local file path or a writeable object (e.g. a pathlib.Path object or an open file descriptor)
- The desired image format. One of
βpngβ
βjpgβ or βjpegβ
βwebpβ
βsvgβ
βpdfβ
βepsβ (Requires the poppler library to be installed and on the PATH)
If not specified and
fileis a string then this will default to the file extension. If not specified andfileis not a string then this will default to:plotly.io.kaleido.scope.default_formatif engine is βkaleidoβplotly.io.orca.config.default_formatif engine is βorcaβ
The width of the exported image in layout pixels. If the
scaleproperty is 1.0, this will also be the width of the exported image in physical pixels.- If not specified, will default to:
plotly.io.kaleido.scope.default_widthif engine is βkaleidoβplotly.io.orca.config.default_widthif engine is βorcaβ
The height of the exported image in layout pixels. If the
scaleproperty is 1.0, this will also be the height of the exported image in physical pixels.- If not specified, will default to:
plotly.io.kaleido.scope.default_heightif engine is βkaleidoβplotly.io.orca.config.default_heightif engine is βorcaβ
scale (int or float or None) β
The scale factor to use when exporting the figure. A scale factor larger than 1.0 will increase the image resolution with respect to the figureβs layout pixel dimensions. Whereas as scale factor of less than 1.0 will decrease the image resolution.
- If not specified, will default to:
plotly.io.kaleido.scope.default_scaleif engine is βkaleidoβplotly.io.orca.config.default_scaleif engine is βorcaβ
validate (bool) β True if the figure should be validated before being converted to an image, False otherwise.
engine (str) β
- Image export engine to use:
βkaleidoβ: Use Kaleido for image export
βorcaβ: Use Orca for image export
βautoβ (default): Use Kaleido if installed, otherwise use orca
- Returns
- Return type
