Skip to content

Commit

Permalink
DOC: Use nbsphinx
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Geier <Matthias.Geier@gmail.com>
  • Loading branch information
mgeier committed Aug 5, 2020
1 parent dc2cf24 commit 3a3a7dc
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 54 deletions.
2 changes: 1 addition & 1 deletion docs/environment.yml
Expand Up @@ -9,4 +9,4 @@ dependencies:
- numpy
- pandas
- bqplot
- jupyter_sphinx
- nbsphinx
2 changes: 1 addition & 1 deletion docs/source/conf.py
Expand Up @@ -42,7 +42,7 @@
'sphinx.ext.autosummary',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'jupyter_sphinx.embed_widgets',
'nbsphinx',
]

autosummary_generate = True
Expand Down
94 changes: 94 additions & 0 deletions docs/source/usage.ipynb
@@ -0,0 +1,94 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Usage\n",
"\n",
"## Examples\n",
"\n",
"Using the pyplot API"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from bqplot import pyplot as plt\n",
"\n",
"plt.figure(1, title='Line Chart')\n",
"np.random.seed(0)\n",
"n = 200\n",
"x = np.linspace(0.0, 10.0, n)\n",
"y = np.cumsum(np.random.randn(n))\n",
"plt.plot(x, y)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Using the bqplot internal object model"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from IPython.display import display\n",
"from bqplot import (\n",
"OrdinalScale, LinearScale, Bars, Lines, Axis, Figure\n",
")\n",
"\n",
"size = 20\n",
"np.random.seed(0)\n",
"\n",
"x_data = np.arange(size)\n",
"\n",
"x_ord = OrdinalScale()\n",
"y_sc = LinearScale()\n",
"\n",
"bar = Bars(x=x_data, y=np.random.randn(2, size), scales={'x': x_ord, 'y':\n",
"y_sc}, type='stacked')\n",
"line = Lines(x=x_data, y=np.random.randn(size), scales={'x': x_ord, 'y': y_sc},\n",
" stroke_width=3, colors=['red'], display_legend=True, labels=['Line chart'])\n",
"\n",
"ax_x = Axis(scale=x_ord, grid_lines='solid', label='X')\n",
"ax_y = Axis(scale=y_sc, orientation='vertical', tick_format='0.2f',\n",
" grid_lines='solid', label='Y')\n",
"\n",
"Figure(marks=[bar, line], axes=[ax_x, ax_y], title='API Example',\n",
" legend_location='bottom-right')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
52 changes: 0 additions & 52 deletions docs/source/usage.rst

This file was deleted.

0 comments on commit 3a3a7dc

Please sign in to comment.