Skip to content

Instantly share code, notes, and snippets.

@simonthor
Last active April 25, 2020 21:16
Show Gist options
  • Save simonthor/ad6fd1e7261e87458c61a2245fa78f37 to your computer and use it in GitHub Desktop.
Save simonthor/ad6fd1e7261e87458c61a2245fa78f37 to your computer and use it in GitHub Desktop.
Test for uploading code to binder
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"from ipywidgets import interactive\n",
"import ipywidgets as widgets\n",
"from IPython.display import display\n",
"from matplotlib import pyplot as plt\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bb12d1e3c96d44f5a1f9f354028c5702",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='a', max=1.0, min=-1.0), Output()), _dom_classes=('wi…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x = np.linspace(-2*np.pi, 2*np.pi, 200)\n",
"\n",
"def plotter(a):\n",
" global x\n",
" plt.plot(x, a*np.sin(x))\n",
" plt.xlim(x[0], x[-1])\n",
" plt.ylim(-1, 1)\n",
" plt.show()\n",
" \n",
"slider = interactive(plotter, a=(-1, 1, 0.1))\n",
"display(slider)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.8.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
name: binder-test
channels:
- conda-forge
dependencies:
- python=3.8
- numpy
- matplotlib
@simonthor
Copy link
Author

Binder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment