Debian Codegraph @

tests/data/notebooks/outputs/ipynb_to_myst/plotly_graphs.md

raw
1 ---
2 kernelspec:
3 display_name: Python 3
4 language: python
5 name: python3
6 ---
7
8 This notebook contains complex outputs, including plotly javascript graphs.
9
10 +++
11
12 # Interactive plots
13
14 +++
15
16 We use Plotly's connected mode to make the notebook lighter - when connected, the notebook downloads the `plotly.js` library from the web.
17
18 ```{code-cell} ipython3
19 import plotly.offline as offline
20 offline.init_notebook_mode(connected=True)
21 ```
22
23 ```{code-cell} ipython3
24 import plotly.graph_objects as go
25 fig = go.Figure(
26 data=[go.Bar(y=[2, 3, 1])],
27 layout=go.Layout(title="bar plot"))
28 fig.show()
29 fig.data[0].marker = dict(color='purple')
30 fig
31 ```