{
 "metadata": {
  "name": "",
  "signature": "sha256:c9e40373a68bb66e5ce4f711b0cce4b6303718e9d4fc69080f469e023efccb33"
 },
 "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": [
      "# fixed width and height\n",
      "p1 = figure(title=\"width/height screen units\")\n",
      "p1.rect(x, y, 6, 4, color=\"tomato\", width_units=\"screen\", height_units=\"screen\")\n",
      "show(p1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variable width and height\n",
      "w = 0.02*np.exp(1+0.1*x)\n",
      "h = 0.2*abs(np.cos(x))\n",
      "p2 = figure(title=\"variable width/height\")\n",
      "p2.rect(x, y, w, h, color=\"olivedrab\", alpha=0.6)\n",
      "show(p2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# angle\n",
      "a = -np.pi/6\n",
      "p3 = figure(title=\"angle\")\n",
      "p3.rect(x, y, 0.1, 0.1, alpha=0.5, color=\"navy\", angle=a)\n",
      "show(p3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}