GeezerVison is showing plotly.com — plotly.io.to_image — 7.1.0 documentation
-
plotly.io.to_image(fig: Union[dict, plotly.graph_objects._figure.Figure], format: Optional[str] = None, width: Optional[int] = None, height: Optional[int] = None, scale: Optional[Union[int, float]] = None, validate: bool = True) → bytes¶
Convert a figure to a static image bytes string
- Parameters
fig – Figure object or dict representing a figure
format (str) –
- (optional) The desired image format. One of:
’png’
’jpg’ or ‘jpeg’
’webp’
’svg’
’pdf’
Defaults to plotly.io.defaults.default_format.
width (int) – (optional) The width of the exported image in layout pixels. If the
scale property is 1.0, this will also be the width of the exported image
in physical pixels. Defaults to plotly.io.defaults.default_width.
height (int) – (optional) The height of the exported image in layout pixels. If the
scale property is 1.0, this will also be the height of the exported image
in physical pixels. Defaults to plotly.io.defaults.default_height.
scale (int or float) – (optional) 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, while a scale factor of
less than 1.0 will decrease the image resolution. Defaults to
plotly.io.defaults.default_scale.
validate (bool) – (optional) True if the figure should be validated before being converted
to an image, False otherwise. Defaults to True.
- Returns
The image data
- Return type
bytes