Skip to content

Commit 9ab1c69

Browse files
fixing <!--#region-->
1 parent 9af87c9 commit 9ab1c69

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/python/dropdowns.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,15 @@ fig.update_layout(title_text="Yahoo")
444444
fig.show()
445445
```
446446

447-
### Creating several independent graphs and using Jinja to insert them into a JavaScript enabled webpage
447+
### Graph Selection Dropdowns in Jinja
448448

449449
It is straight forward to create each potential view as a separate graph and then use Jinja to insert each potential view into a div on a JavaScript enabled webpage with a drop down that chooses which div to display. This approach produces code that requires little customization or updating as you e.g. add, drop, or reorder views or traces, so it is particularly compelling for prototyping and rapid iteration. It produces web pages that are larger than the webpages produced through the built in method which is a consideration for very large figures with hundreds or thousands of data points in traces that appear in multiple selections. This approach requires both a Python program and a Jinja template file. The documentation on [using Jinja templates with Plotly](https://plotly.com/python/interactive-html-export/#inserting-plotly-output-into-html-using-a-jinja2-template) is relevant background.
450450

451+
<!-- #region -->
452+
451453
#### Python Code File
452454

453-
```
455+
```python
454456
import plotly.express as px
455457
from jinja2 import Template
456458
import collections
@@ -504,7 +506,6 @@ with open(output_html_path, "w", encoding='utf-8') as output_file:
504506

505507
#### Jinja HTML Template
506508

507-
<!-- #region -->
508509

509510
```
510511
&lt;!DOCTYPE html&gt;
@@ -540,7 +541,7 @@ with open(output_html_path, "w", encoding='utf-8') as output_file:
540541
&lt;/html&gt;
541542
```
542543

543-
544+
<!-- #endregion -->
544545

545546
#### Reference
546547
See https://plotly.com/python/reference/layout/updatemenus/ for more information about `updatemenu` dropdowns.

0 commit comments

Comments
 (0)