Skip to content

Commit 235c809

Browse files
interact html export docs
1 parent fcab197 commit 235c809

File tree

2 files changed

+70
-3
lines changed

2 files changed

+70
-3
lines changed

Diff for: doc/python/interactive-html-export.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
jupyter:
3+
jupytext:
4+
notebook_metadata_filter: all
5+
text_representation:
6+
extension: .md
7+
format_name: markdown
8+
format_version: '1.2'
9+
jupytext_version: 1.3.1
10+
kernelspec:
11+
display_name: Python 3
12+
language: python
13+
name: python3
14+
language_info:
15+
codemirror_mode:
16+
name: ipython
17+
version: 3
18+
file_extension: .py
19+
mimetype: text/x-python
20+
name: python
21+
nbconvert_exporter: python
22+
pygments_lexer: ipython3
23+
version: 3.6.8
24+
plotly:
25+
description: Plotly allows you to save interactive HTML versions of your figures
26+
to your local disk.
27+
display_as: file_settings
28+
language: python
29+
layout: base
30+
name: Interactive HTML Export
31+
order: 30
32+
page_type: u-guide
33+
permalink: python/interactive-html-export/
34+
thumbnail: thumbnail/static-image-export.png
35+
---
36+
37+
### Interactive vs Static Export
38+
39+
Plotly figures are interactive when viewed in a web browser: you can hover over data points, pan and zoom axes, and show and hide traces by clicking or double-clicking on the legend. You can export figures either to [static image file formats like PNG, JEPG, SVG or PDF](/python/static-image-export/) or you can export them to HTML files which can be opened in a browser. This page explains how to do the latter.
40+
41+
<!-- #region -->
42+
### Saving to an HTML file
43+
44+
Any figure can be saved an HTML file using the `write_html` method. These HTML files can be opened in any web browser to access the fully interactive figure.
45+
46+
```python
47+
import plotly.express as px
48+
49+
fig =px.scatter(x=range(10), y=range(10))
50+
fig.write_html("path/to/file.html")
51+
```
52+
<!-- #endregion -->
53+
54+
### Controlling the size of the HTML file
55+
56+
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).
57+
58+
59+
### Full Parameter Documentation
60+
61+
```python
62+
import plotly.graph_objects as go
63+
64+
help(go.Figure.write_html)
65+
```

Diff for: doc/python/static-image-export.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ jupyter:
3535
thumbnail: thumbnail/static-image-export.png
3636
---
3737

38-
<!-- #region -->
39-
### Static Image Export
40-
It's possible to programmatically export figures as high quality static images while fully offline.
38+
### Interactive vs Static Export
39+
40+
Plotly figures are interactive when viewed in a web browser: you can hover over data points, pan and zoom axes, and show and hide traces by clicking or double-clicking on the legend. You can export figures either to static image file formats like PNG, JEPG, SVG or PDF or you can [export them to HTML files which can be opened in a browser and remain interactive](/python/interactive-html-export/). This page explains how to do the former.
4141

42+
43+
<!-- #region -->
4244
#### Install Dependencies
4345
Static image generation requires the [orca](https://github.com/plotly/orca) commandline utility and the [psutil](https://github.com/giampaolo/psutil) and [requests](https://2.python-requests.org/en/master/) Python libraries. There are 3 general approach to installing these dependencies.
4446

0 commit comments

Comments
 (0)