{
 "metadata": {
  "name": "",
  "signature": "sha256:8dd264b21cad2f1c28e2a45215a710ddc1d32b090e24d7a03edf07b0b5e7b8da"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "raw",
     "metadata": {},
     "source": [
      "This IPython Notebook contains simple examples of the rect function. \n",
      "\n",
      "To clear all previously rendered cell outputs, select from the menu:\n",
      "\n",
      "    Cell -> All Output -> Clear"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "from bokeh.plotting import *"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "N = 80"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "x = np.linspace(0, 4*np.pi, N)\n",
      "y = np.sin(x)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "output_notebook()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "figure(tools=\"pan,wheel_zoom,box_zoom,reset,previewsave\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# fixed width and height\n",
      "rect(x, y, 4, 2, \n",
      "     width_units=\"screen\", height_units=\"screen\", \n",
      "     color=\"#ff0000\"\n",
      ")\n",
      "show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variable width and height\n",
      "rect(\n",
      "    x, y, 0.01*np.exp(1+0.1*x), 0.2*abs(np.cos(x)),\n",
      "    fill_color=\"green\", line_color=None, fill_alpha=0.6\n",
      ")\n",
      "show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# angle\n",
      "rect(x, y, 0.05, 0.1, color=\"#4444aa\", angle=-np.pi/6)\n",
      "show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}