Files
Man1130/jupyter/Man1130-python-comission/tryout/jupyter-voila-helloworld/ipynb/bqplot.ipynb
louiscklaw e44aead3d5 update,
2025-02-01 01:58:19 +08:00

85 lines
1.8 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# So easy, *voilà*!\n",
"\n",
"In this example notebook, we demonstrate how Voilà can render custom Jupyter widgets such as [bqplot](https://github.com/bloomberg/bqplot). "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import warnings\n",
"warnings.filterwarnings('ignore')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f771faf1649e425480af29391b9a238e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(Figure(axes=[Axis(scale=LinearScale()), Axis(orientation='vertical', scale=LinearScale())], fig…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"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": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}