{
 "metadata": {
  "name": "",
  "signature": "sha256:1360311c43c3af8396f3c9f01744068c7cda4b6f35aaed00bba545c991e70c40"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import time\n",
      "from numpy import pi, cos, sin, linspace, roll, zeros_like\n",
      "from bokeh.plotting import *\n",
      "from bokeh.objects import Glyph"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "N = 50 + 1\n",
      "r_base = 8\n",
      "theta = linspace(0, 2*pi, N)\n",
      "r_x = linspace(0, 6*pi, N-1)\n",
      "rmin = r_base - cos(r_x) - 1\n",
      "rmax = r_base + sin(r_x) + 1\n",
      "colors = [\"FFFFCC\", \"#C7E9B4\", \"#7FCDBB\", \"#41B6C4\", \"#2C7FB8\", \"#253494\", \"#2C7FB8\", \"#41B6C4\", \"#7FCDBB\", \"#C7E9B4\"] * 5\n",
      "cx = cy = zeros_like(rmin)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "*To run these examples you must execute the command `python bokeh-server` in the top-level Bokeh source directory first.*"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "output_notebook(url=\"default\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "figure(x_range=[-11, 11], y_range=[-11, 11], tools=\"pan,wheel_zoom,box_zoom,reset,previewsave\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "annular_wedge(\n",
      "    cx, cy, rmin, rmax, theta[:-1], theta[1:],\n",
      "    inner_radius_units=\"data\",\n",
      "    outer_radius_units=\"data\",\n",
      "    fill_color = colors,\n",
      "    line_color=\"black\",\n",
      ")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "renderer = [r for r in curplot().renderers if isinstance(r, Glyph)][0]\n",
      "ds = renderer.data_source\n",
      "show()\n",
      "while True:\n",
      "    for i in linspace(-2*pi, 2*pi, 50):\n",
      "        \n",
      "        rmin = ds.data[\"inner_radius\"]\n",
      "        rmin = roll(rmin, 1)\n",
      "        ds.data[\"inner_radius\"] = rmin\n",
      "        \n",
      "        rmax = ds.data[\"outer_radius\"]\n",
      "        rmax = roll(rmax, -1)\n",
      "        ds.data[\"outer_radius\"] = rmax\n",
      "        \n",
      "        cursession().store_objects(ds)\n",
      "        time.sleep(.10)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}