Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotly #302

Merged
merged 6 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ install:
- pip install ipykernel
- pip install numpy
- pip install matplotlib
- pip install plotly
- pip install pandas
- pip install sphinxcontrib-bibtex
script:
Expand Down
1 change: 1 addition & 0 deletions binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
matplotlib
pandas
plotly
26 changes: 26 additions & 0 deletions doc/code-cells.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,32 @@
"fig"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Plotly\n",
"Is supported out of box"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import plotly.io as pio\n",
"import plotly.graph_objs as go\n",
"pio.renderers.default = \"notebook_connected+plotly_mimetype\"\n",
"\n",
"\n",
"df = pd.DataFrame({\"b\": np.random.choice(2, 10)}, dtype=bool)\n",
"data = [go.Bar(x=df[\"b\"].values, y=df.index.values)]\n",
"pio.show(go.Figure(data))"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
4 changes: 4 additions & 0 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,10 @@ def setup(app):
except AttributeError:
_add_notebook_parser(app)

# require.js for plotly rendering
app.add_javascript(
"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js")

app.add_config_value('nbsphinx_execute', 'auto', rebuild='env')
app.add_config_value('nbsphinx_kernel_name', '', rebuild='env')
app.add_config_value('nbsphinx_execute_arguments', [], rebuild='env')
Expand Down