Convert a figure to an HTML string representation. Parameters ---------- config: dict or None (default None) Plotly.js figure config options auto_play: bool (default=True) Whether to automatically start the animation sequence on page
(self, *args, **kwargs)
| 3515 | return pio.write_json(self, *args, **kwargs) |
| 3516 | |
| 3517 | def to_html(self, *args, **kwargs): |
| 3518 | """ |
| 3519 | Convert a figure to an HTML string representation. |
| 3520 | |
| 3521 | Parameters |
| 3522 | ---------- |
| 3523 | config: dict or None (default None) |
| 3524 | Plotly.js figure config options |
| 3525 | auto_play: bool (default=True) |
| 3526 | Whether to automatically start the animation sequence on page load |
| 3527 | if the figure contains frames. Has no effect if the figure does not |
| 3528 | contain frames. |
| 3529 | include_plotlyjs: bool or string (default True) |
| 3530 | Specifies how the plotly.js library is included/loaded in the output |
| 3531 | div string. |
| 3532 | |
| 3533 | If True, a script tag containing the plotly.js source code (~3MB) |
| 3534 | is included in the output. HTML files generated with this option are |
| 3535 | fully self-contained and can be used offline. |
| 3536 | |
| 3537 | If 'cdn', a script tag that references the plotly.js CDN is included |
| 3538 | in the output. HTML files generated with this option are about 3MB |
| 3539 | smaller than those generated with include_plotlyjs=True, but they |
| 3540 | require an active internet connection in order to load the plotly.js |
| 3541 | library. |
| 3542 | |
| 3543 | If 'directory', a script tag is included that references an external |
| 3544 | plotly.min.js bundle that is assumed to reside in the same |
| 3545 | directory as the HTML file. |
| 3546 | |
| 3547 | If a string that ends in '.js', a script tag is included that |
| 3548 | references the specified path. This approach can be used to point |
| 3549 | the resulting HTML file to an alternative CDN or local bundle. |
| 3550 | |
| 3551 | If False, no script tag referencing plotly.js is included. This is |
| 3552 | useful when the resulting div string will be placed inside an HTML |
| 3553 | document that already loads plotly.js. This option is not advised |
| 3554 | when full_html=True as it will result in a non-functional html file. |
| 3555 | include_mathjax: bool or string (default False) |
| 3556 | Specifies how the MathJax.js library is included in the output html |
| 3557 | div string. MathJax is required in order to display labels |
| 3558 | with LaTeX typesetting. |
| 3559 | |
| 3560 | If False, no script tag referencing MathJax.js will be included in the |
| 3561 | output. |
| 3562 | |
| 3563 | If 'cdn', a script tag that references a MathJax CDN location will be |
| 3564 | included in the output. HTML div strings generated with this option |
| 3565 | will be able to display LaTeX typesetting as long as internet access |
| 3566 | is available. |
| 3567 | |
| 3568 | If a string that ends in '.js', a script tag is included that |
| 3569 | references the specified path. This approach can be used to point the |
| 3570 | resulting HTML div string to an alternative CDN. |
| 3571 | post_script: str or list or None (default None) |
| 3572 | JavaScript snippet(s) to be included in the resulting div just after |
| 3573 | plot creation. The string(s) may include '{plot_id}' placeholders |
| 3574 | that will then be replaced by the `id` of the div element that the |
no outgoing calls