{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from collections import OrderedDict\n",
    "import numpy as np\n",
    "from bokeh.charts import Line, output_notebook, show\n",
    "output_notebook()\n",
    "\n",
    "# create some example data\n",
    "simple_values = OrderedDict(\n",
    "    python=[2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120, 111],\n",
    "    pypy=[12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110, 130],\n",
    "    jython=[22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139, 160],\n",
    ")\n",
    "\n",
    "# create an area chart\n",
    "line = Line(\n",
    "    simple_values, title=\"Area Chart\", xlabel='time',\n",
    "    ylabel='memory', notebook=True, legend=\"top_left\"\n",
    ")\n",
    "show(line)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# Here is some code to read in some stock data from the Yahoo Finance API\n",
    "AAPL = pd.read_csv(\n",
    "    \"http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010\",\n",
    "    parse_dates=['Date'])\n",
    "MSFT = pd.read_csv(\n",
    "    \"http://ichart.yahoo.com/table.csv?s=MSFT&a=0&b=1&c=2000&d=0&e=1&f=2010\",\n",
    "    parse_dates=['Date'])\n",
    "IBM = pd.read_csv(\n",
    "    \"http://ichart.yahoo.com/table.csv?s=IBM&a=0&b=1&c=2000&d=0&e=1&f=2010\",\n",
    "    parse_dates=['Date'])\n",
    "\n",
    "sxyvalues = OrderedDict(\n",
    "    AAPL=AAPL['Adj Close'],\n",
    "    MSFT=MSFT['Adj Close'],\n",
    "    IBM=IBM['Adj Close'],\n",
    ")\n",
    "\n",
    "# create an area chart\n",
    "line = Line(\n",
    "    sxyvalues, title=\"Medals\",legend=\"top_left\",\n",
    "    ylabel='Performance', notebook=True,\n",
    ")\n",
    "show(line)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# create an area chart\n",
    "df = pd.DataFrame(sxyvalues)\n",
    "line = Line(\n",
    "    df, title=\"Area Chart\", ylabel='Performance', notebook=True,\n",
    ")\n",
    "show(line)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "line = Line(\n",
    "    list(sxyvalues.values()), title=\"Line Chart\",\n",
    "    ylabel='Performance', notebook=True, legend=\"top_left\"\n",
    ")\n",
    "show(line)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from blaze import Data, into\n",
    "bvalues = Data(pd.DataFrame(simple_values))\n",
    "line = Line(\n",
    "    bvalues, title=\"Line Chart\",\n",
    "    ylabel='Performance', notebook=True, legend=\"top_left\"\n",
    ")\n",
    "show(line)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from bokeh.sampledata import iris\n",
    "from os.path import dirname, join\n",
    "\n",
    "bbvalues = Data(join(dirname(iris.__file__), 'iris.csv'))\n",
    "columns = ['sepal_length', 'sepal_width', 'petal_length', 'petal_width']\n",
    "result = bbvalues[columns]\n",
    "line = Line(\n",
    "    result, title=\"Line Chart\",\n",
    "    ylabel='Petals', notebook=True, legend=\"top_left\"\n",
    ")\n",
    "show(line)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
