Skip to content

Commit 7a909ca

Browse files
committed
Update interactive-html-export.md
1 parent 30d0deb commit 7a909ca

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

doc/python/interactive-html-export.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ fig.write_html("path/to/file.html")
5151
```
5252
<!-- #endregion -->
5353

54-
<!-- #region -->
5554
### Controlling the size of the HTML file
5655

5756
By default, the resulting HTML file is a fully self-contained HTML file which can be uploaded to a web server or shared via email or other file-sharing mechanisms. The downside to this approach is that the file is very large (5Mb+) because it contains an inlined copy of the Plotly.js library required to make the figure interactive. This can be controlled via the `include_plotlyjs` argument (see below).
@@ -61,16 +60,18 @@ By default, the resulting HTML file is a fully self-contained HTML file which ca
6160
You can insert Plotly output and text related to your data into HTML templates using Jinja2. Use `.to_html` to send the HTML to a Python string variable rather than using `write_html` to send the HTML to a disk file. Use the `full_html=False` option to output just the code necessary to add a figure to a template. We don't want to output a full HTML page, as the template will define the rest of the page's structure — for example, the page's `HTML` and `BODY` tags. First create an HTML template file containing a Jinja `{{ variable }}`. In this example, we customize the HTML in the template file by replacing the Jinja variable `{{ fig }}` with our graphic `fig`.
6261

6362
```
64-
<!DOCTYPE html>
65-
<html>
66-
<body>
67-
<h1>Here's a Plotly graph!</h1>
63+
&lt;!DOCTYPE html&gt;
64+
&lt;html&gt;
65+
&lt;body&gt;
66+
&lt;h1&gt;Here's a Plotly graph!&lt;/h1&gt;
6867
{{ fig }}
69-
<p>And here's some text after the graph.</p>
70-
</body>
71-
</html>
68+
&lt;p&gt;And here's some text after the graph.&lt;/p&gt;
69+
&lt;/body&gt;
70+
&lt;/html&gt;
7271
```
7372

73+
<!-- #region -->
74+
7475
Then use the following Python to replace `{{ fig }}` in the template with HTML that will display the Plotly figure "fig":
7576

7677
```python

0 commit comments

Comments
 (0)