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
(
fig: Union[dict, plotly.graph_objects.Figure],
file: Union[str, Path],
format: Union[str, None] = None,
scale: Union[int, float, None] = None,
width: Union[int, None] = None,
height: Union[int, None] = None,
validate: bool = True,
# Deprecated
engine: Union[str, None] = None,
)
| 423 | |
| 424 | |
| 425 | def write_image( |
| 426 | fig: Union[dict, plotly.graph_objects.Figure], |
| 427 | file: Union[str, Path], |
| 428 | format: Union[str, None] = None, |
| 429 | scale: Union[int, float, None] = None, |
| 430 | width: Union[int, None] = None, |
| 431 | height: Union[int, None] = None, |
| 432 | validate: bool = True, |
| 433 | # Deprecated |
| 434 | engine: Union[str, None] = None, |
| 435 | ): |
| 436 | """ |
| 437 | Convert a figure to a static image and write it to a file or writeable |
| 438 | object |
| 439 | |
| 440 | Parameters |
| 441 | ---------- |
| 442 | fig: |
| 443 | Figure object or dict representing a figure |
| 444 | |
| 445 | file: str or writeable |
| 446 | A string representing a local file path or a writeable object |
| 447 | (e.g. a pathlib.Path object or an open file descriptor) |
| 448 | |
| 449 | format: str or None |
| 450 | The desired image format. One of |
| 451 | - 'png' |
| 452 | - 'jpg' or 'jpeg' |
| 453 | - 'webp' |
| 454 | - 'svg' |
| 455 | - 'pdf' |
| 456 | - 'eps' (deprecated) (Requires the poppler library to be installed and on the PATH) |
| 457 | |
| 458 | If not specified and `file` is a string then this will default to the |
| 459 | file extension. If not specified and `file` is not a string then this |
| 460 | will default to: |
| 461 | - `plotly.io.defaults.default_format` if engine is "kaleido" |
| 462 | - `plotly.io.orca.config.default_format` if engine is "orca" (deprecated) |
| 463 | |
| 464 | width: int or None |
| 465 | The width of the exported image in layout pixels. If the `scale` |
| 466 | property is 1.0, this will also be the width of the exported image |
| 467 | in physical pixels. |
| 468 | |
| 469 | If not specified, will default to: |
| 470 | - `plotly.io.defaults.default_width` if engine is "kaleido" |
| 471 | - `plotly.io.orca.config.default_width` if engine is "orca" (deprecated) |
| 472 | |
| 473 | height: int or None |
| 474 | The height of the exported image in layout pixels. If the `scale` |
| 475 | property is 1.0, this will also be the height of the exported image |
| 476 | in physical pixels. |
| 477 | |
| 478 | If not specified, will default to: |
| 479 | - `plotly.io.defaults.default_height` if engine is "kaleido" |
| 480 | - `plotly.io.orca.config.default_height` if engine is "orca" (deprecated) |
| 481 | |
| 482 | scale: int or float or None |
nothing calls this directly
no test coverage detected