Debian Codegraph @

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

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