<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from IPython.display import display\n",
    "from bqplot import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Basic Map ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo = Mercator()\n",
    "x = Map(map_data=topo_load('WorldMapData.json'), scales={'projection': sc_geo})\n",
    "fig = Figure(marks=[x])\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Advanced Map and Projection ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "sc_geo = Orthographic()\n",
    "x = Map(map_data=topo_load('WorldMapData.json'), scales={'projection': sc_geo})\n",
    "fig = Figure(marks=[x], fig_color='deepskyblue')\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo.scale = 350"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chloropleth ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo = Mercator()\n",
    "sc_c1 = ColorScale(scheme='YlOrRd')\n",
    "\n",
    "map_styles = {'color': {643: 200., 4: 21., 398: 23., 156: 42., 124:78., 76: 98.}, \n",
    "              'scales': {'projection': sc_geo, 'color': sc_c1}}\n",
    "\n",
    "axis = ColorAxis(scale=sc_c1)\n",
    "\n",
    "x = Map(map_data=topo_load('WorldMapData.json'), **map_styles)\n",
    "fig = Figure(marks=[x], axes=[axis])\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Alternate Map Data ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo = AlbersUSA()\n",
    "x = Map(map_data=topo_load('USMapData.json'), \n",
    "            scales={'projection': sc_geo})\n",
    "fig = Figure(marks=[x])\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Interactions ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "def_tt = Tooltip(fields=['id', 'name'])\n",
    "map_mark = Map(map_data=topo_load('WorldMapData.json'), \n",
    "               scales={'projection': Mercator()}, tooltip=def_tt)\n",
    "map_mark.interactions = {'click': 'select', 'hover': 'tooltip'}\n",
    "fig = Figure(marks=[map_mark])\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "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
}<commit_msg>Change Map Example notebook<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from IPython.display import display\n",
    "from bqplot import (Figure, Map, Mercator, Orthographic, ColorScale, ColorAxis,\n",
    "                    AlbersUSA, topo_load, Tooltip)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Basic Map ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo = Mercator()\n",
    "x = Map(scales={'projection': sc_geo})\n",
    "fig = Figure(marks=[x])\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Advanced Map and Projection ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo = Orthographic()\n",
    "x = Map(map_data=topo_load('WorldMapData.json'), scales={'projection': sc_geo})\n",
    "fig = Figure(marks=[x], fig_color='deepskyblue')\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo.scale = 350"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chloropleth ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo = Mercator()\n",
    "sc_c1 = ColorScale(scheme='YlOrRd')\n",
    "\n",
    "map_styles = {'color': {643: 105., 4: 21., 398: 23., 156: 42., 124:78., 76: 98.}, \n",
    "              'scales': {'projection': sc_geo, 'color': sc_c1}}\n",
    "\n",
    "axis = ColorAxis(scale=sc_c1)\n",
    "\n",
    "x = Map(map_data=topo_load('WorldMapData.json'), **map_styles)\n",
    "fig = Figure(marks=[x], axes=[axis])\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Alternate Map Data ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_geo = AlbersUSA()\n",
    "x = Map(map_data=topo_load('USMapData.json'), \n",
    "            scales={'projection': sc_geo})\n",
    "fig = Figure(marks=[x])\n",
    "display(fig)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Interactions ##"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "def_tt = Tooltip(fields=['id', 'name'])\n",
    "map_mark = Map(scales={'projection': Mercator()}, tooltip=def_tt)\n",
    "map_mark.interactions = {'click': 'select', 'hover': 'tooltip'}\n",
    "fig = Figure(marks=[map_mark])\n",
    "display(fig)"
   ]
  }
 ],
 "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.11"
  },
  "widgets": {
   "state": {},
   "version": "2.0.0-dev"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
{'fraction_non_alphanumeric': 0.23268853378188956, 'fraction_numerical': 0.012615643397813289, 'mean_word_length': 2.7375589313776847, 'pattern_counts': {'":': 161, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '66595', 'n_tokens_mistral': 2887, 'n_tokens_neox': 2783, 'n_words': 460}