{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import holoviews as hv\n",
    "from holoviews import opts\n",
    "hv.extension('bokeh')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Define data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sqlite3\n",
    "from bokeh.sampledata import movies_data\n",
    "\n",
    "# Load data\n",
    "conn = sqlite3.connect(movies_data.movie_path)\n",
    "movies = pd.read_sql('SELECT userRating, imdbRating FROM omdb, tomatoes WHERE omdb.ID = tomatoes.ID', conn)\n",
    "\n",
    "# Declare element\n",
    "hextiles = hv.HexTiles(movies, [('userRating', 'Tomato User Rating'), ('imdbRating', 'IMDb Rating')], [])\n",
    "bivariate = hv.Bivariate(hextiles)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plot data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "(hextiles * bivariate).opts(\n",
    "    opts.Bivariate(show_legend=False),\n",
    "    opts.HexTiles(width=500, height=500, min_count=0))"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
