Skip to content

Commit 4825440

Browse files
committed
Push down pio import in first dictionary example
1 parent 58a9154 commit 4825440

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

notebooks/creating-updating-figures.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ jupyter:
3131
## Figures as dictionaries
3232
The goal of plotly.py is to provide a pleasant Python interface for creating figure specifications for display in the Plotly.js JavaScript library. In Plotly.js, a figure is specified by a declarative JSON data structure, and so the ultimate responsibility of plotly.py is to produce Python dictionaries that can be serialized into a JSON data structure that represents a valid figure.
3333

34-
As a concrete example, here is the Python dictionary that represents a figure containing a single bar trace and a title.
34+
As a concrete example, here is a Python dictionary that represents a figure containing a single bar trace and a title.
3535

3636
```python
37-
import plotly.io as pio
3837
fig = {
3938
"data": [{"type": "bar",
4039
"x": [1, 2, 3],
4140
"y": [1, 3, 2]}],
4241
"layout": {"title": {"text": "A Bar Chart"}}
4342
}
43+
44+
# To display the figure defined by this dict, use the low-level plotly.io.show function
45+
import plotly.io as pio
4446
pio.show(fig)
4547
```
4648

0 commit comments

Comments
 (0)