Convert a figure to a static image bytes string Parameters ---------- format: str or None The desired image format. One of - 'png' - 'jpg' or 'jpeg' - 'webp' - 'svg' - 'pdf'
(self, *args, **kwargs)
| 3712 | return pio.write_html(self, *args, **kwargs) |
| 3713 | |
| 3714 | def to_image(self, *args, **kwargs): |
| 3715 | """ |
| 3716 | Convert a figure to a static image bytes string |
| 3717 | |
| 3718 | Parameters |
| 3719 | ---------- |
| 3720 | format: str or None |
| 3721 | The desired image format. One of |
| 3722 | - 'png' |
| 3723 | - 'jpg' or 'jpeg' |
| 3724 | - 'webp' |
| 3725 | - 'svg' |
| 3726 | - 'pdf' |
| 3727 | - 'eps' (deprecated) (Requires the poppler library to be installed) |
| 3728 | |
| 3729 | If not specified, will default to: |
| 3730 | - `plotly.io.defaults.default_format` if engine is "kaleido" |
| 3731 | - `plotly.io.orca.config.default_format` if engine is "orca" (deprecated) |
| 3732 | |
| 3733 | width: int or None |
| 3734 | The width of the exported image in layout pixels. If the `scale` |
| 3735 | property is 1.0, this will also be the width of the exported image |
| 3736 | in physical pixels. |
| 3737 | |
| 3738 | If not specified, will default to: |
| 3739 | - `plotly.io.defaults.default_width` if engine is "kaleido" |
| 3740 | - `plotly.io.orca.config.default_width` if engine is "orca" (deprecated) |
| 3741 | |
| 3742 | height: int or None |
| 3743 | The height of the exported image in layout pixels. If the `scale` |
| 3744 | property is 1.0, this will also be the height of the exported image |
| 3745 | in physical pixels. |
| 3746 | |
| 3747 | If not specified, will default to: |
| 3748 | - `plotly.io.defaults.default_height` if engine is "kaleido" |
| 3749 | - `plotly.io.orca.config.default_height` if engine is "orca" (deprecated) |
| 3750 | |
| 3751 | scale: int or float or None |
| 3752 | The scale factor to use when exporting the figure. A scale factor |
| 3753 | larger than 1.0 will increase the image resolution with respect |
| 3754 | to the figure's layout pixel dimensions. Whereas as scale factor of |
| 3755 | less than 1.0 will decrease the image resolution. |
| 3756 | |
| 3757 | If not specified, will default to: |
| 3758 | - `plotly.io.defaults.default_scale` if engine is "kaliedo" |
| 3759 | - `plotly.io.orca.config.default_scale` if engine is "orca" (deprecated) |
| 3760 | |
| 3761 | validate: bool |
| 3762 | True if the figure should be validated before being converted to |
| 3763 | an image, False otherwise. |
| 3764 | |
| 3765 | engine (deprecated): str |
| 3766 | Image export engine to use. This parameter is deprecated and Orca engine support will be |
| 3767 | dropped in the next major Plotly version. Until then, the following values are supported: |
| 3768 | - "kaleido": Use Kaleido for image export |
| 3769 | - "orca": Use Orca for image export |
| 3770 | - "auto" (default): Use Kaleido if installed, otherwise use Orca |
| 3771 |