{ "metadata": { "name": "", "signature": "sha256:0f754c06757ef5de75d6b3deebbcb8bc994029b6399ce2023a416daa2abe8242" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "%matplotlib inline\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from ipywidgets import StaticInteract, RangeWidget" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "def plot(n):\n", " fig, ax = plt.subplots(figsize=(4, 3),\n", " subplot_kw={'axisbg':'#EEEEEE',\n", " 'axisbelow':True})\n", " ax.grid(color='w', linewidth=2, linestyle='solid')\n", " x = np.linspace(0, 10, 1000)\n", " ax.plot(x, np.sin((n*np.pi/10)*x),lw=5, alpha=0.4)\n", " #ax.set_xlim(0, 10)\n", " #ax.set_ylim(-1.1, 1.1)\n", " return fig" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 12 }, { "cell_type": "code", "collapsed": false, "input": [ "StaticInteract(plot,n=RangeWidget(1, 10, 1))" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", " \n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", "
\n", " \n", " n: \n", "
\n", " " ], "metadata": {}, "output_type": "pyout", "prompt_number": 13, "text": [ "" ] } ], "prompt_number": 13 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }