{
 "metadata": {
  "name": "",
  "signature": "sha256:45f826a8f2128d1c110e2d455164ecfe0809dbb145725078ab2dccb884586622"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from bokeh.plotting import *\n",
      "from bokeh.models import ColumnDataSource"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "output_notebook()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "N = 300\n",
      "x = np.linspace(0, 4*np.pi, N)\n",
      "y1 = np.sin(x)\n",
      "y2 = np.cos(x)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "source = ColumnDataSource()\n",
      "source.add(data=x, name='x')\n",
      "source.add(data=y1, name='y1')\n",
      "source.add(data=y2, name='y2')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "TOOLS = \"pan,wheel_zoom,box_zoom,reset,save,box_select,lasso_select\"\n",
      "\n",
      "s1 = figure(tools=TOOLS, plot_width=350, plot_height=350)\n",
      "s1.scatter('x', 'y1', source=source)\n",
      "\n",
      "# Linked brushing in Bokeh is expressed by sharing data sources between\n",
      "# renderers. Note below that s2.scatter is called with the `source` \n",
      "# keyword argument, and supplied with the same data source from s1.scatter\n",
      "s2 = figure(tools=TOOLS, plot_width=350, plot_height=350)\n",
      "s2.scatter('x', 'y2', source=source)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = gridplot([[s1,s2]])\n",
      "show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}
