Skip to content

Instantly share code, notes, and snippets.

@rutj3
Created October 26, 2016 13:24
Show Gist options
  • Save rutj3/f245a4541f9042d825de7063747c48e0 to your computer and use it in GitHub Desktop.
Save rutj3/f245a4541f9042d825de7063747c48e0 to your computer and use it in GitHub Desktop.
bokeh_argentina
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"bd90b2ef-f969-4ad9-be25-be14a429baf2\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = \"1\";\n",
"\n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force !== \"\") {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
"\n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force !== \"\") {\n",
" window._bokeh_timeout = Date.now() + 5000;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" Bokeh.$(\"#bd90b2ef-f969-4ad9-be25-be14a429baf2\").text(\"BokehJS successfully loaded.\");\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"bd90b2ef-f969-4ad9-be25-be14a429baf2\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'bd90b2ef-f969-4ad9-be25-be14a429baf2' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
"\n",
" var js_urls = ['https://cdn.pydata.org/bokeh/release/bokeh-0.12.3.min.js', 'https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.3.min.js'];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" Bokeh.$(\"#bd90b2ef-f969-4ad9-be25-be14a429baf2\").text(\"BokehJS is loading...\");\n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.3.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.3.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.3.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.3.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === \"1\")) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === \"1\") {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (!force) {\n",
" var cell = $(\"#bd90b2ef-f969-4ad9-be25-be14a429baf2\").parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(this));"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from bokeh.io import show, output_notebook\n",
"from bokeh.models import (\n",
" GeoJSONDataSource,\n",
" ColumnDataSource,\n",
" HoverTool,\n",
" LinearColorMapper\n",
")\n",
"from bokeh.plotting import figure\n",
"from bokeh.palettes import Viridis6\n",
"\n",
"output_notebook()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"with open(r'D:\\argentina.geojson', 'r') as f:\n",
" argjson = f.read()\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"geo_source = GeoJSONDataSource(geojson=argjson)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
" <div class=\"bk-root\">\n",
" <div class=\"plotdiv\" id=\"2b0bf5c2-a194-414c-a419-da5df23656ef\"></div>\n",
" </div>\n",
"<script type=\"text/javascript\">\n",
" \n",
" (function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
" \n",
" var force = \"\";\n",
" \n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force !== \"\") {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
" \n",
" \n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force !== \"\") {\n",
" window._bokeh_timeout = Date.now() + 0;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
" \n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
" \n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" Bokeh.$(\"#2b0bf5c2-a194-414c-a419-da5df23656ef\").text(\"BokehJS successfully loaded.\");\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
" \n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
" \n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"2b0bf5c2-a194-414c-a419-da5df23656ef\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '2b0bf5c2-a194-414c-a419-da5df23656ef' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
" \n",
" var js_urls = [];\n",
" \n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.$(function() {\n",
" var docs_json = {\"3a7ce5bd-5a1f-416f-a74c-c701fc2d3bc2\":{\"roots\":{\"references\":[{\"attributes\":{\"plot\":{\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"2834fb9c-9a38-417f-a6e6-0f6343646da1\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"7abf13f9-e134-4648-bd08-9a7e62922f32\",\"type\":\"GeoJSONDataSource\"},\"glyph\":{\"id\":\"e2b9e847-a44e-411e-9fac-f8c5aa735f4a\",\"type\":\"Patches\"},\"hover_glyph\":null,\"nonselection_glyph\":{\"id\":\"e4f10ef6-b8a2-4d2b-870c-e0e675fba3f7\",\"type\":\"Patches\"},\"selection_glyph\":null},\"id\":\"476aa3ff-cf5d-4046-a5b7-882fc40b67cb\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"palette\":[\"#440154\",\"#404387\",\"#29788E\",\"#22A784\",\"#79D151\",\"#FDE724\"]},\"id\":\"664d1cb0-712d-416a-a5ea-ef26f9f629d0\",\"type\":\"LinearColorMapper\"},{\"attributes\":{\"callback\":null},\"id\":\"8aea2d5d-91aa-4ca3-b1e8-d72a2ecb6d6c\",\"type\":\"DataRange1d\"},{\"attributes\":{\"plot\":null,\"text\":\"Argentina\"},\"id\":\"5575f20d-df99-431b-b21c-9c615f6a1e7d\",\"type\":\"Title\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"9a4dc743-2a34-45ff-ac52-bb95a1b0fd09\",\"type\":\"BasicTicker\"}},\"id\":\"34bff219-52f0-4dc2-a109-04bf4d93a68e\",\"type\":\"Grid\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1666396f-d1b2-4fc5-a443-3cf28dce8b3e\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"callback\":null,\"plot\":{\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"point_policy\":\"follow_mouse\",\"tooltips\":[[\"Provincia:\",\"@provincia\"]]},\"id\":\"e311de4e-7ad9-4042-a566-87e9f96715f4\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"9a4dc743-2a34-45ff-ac52-bb95a1b0fd09\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1666396f-d1b2-4fc5-a443-3cf28dce8b3e\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"79cef3ce-aaf7-43ca-9786-fb5474d42feb\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"plot_height\":300,\"plot_width\":500,\"renderers\":[{\"id\":\"8167eab1-8b24-41c0-84e7-76027f270ea9\",\"type\":\"Grid\"},{\"id\":\"34bff219-52f0-4dc2-a109-04bf4d93a68e\",\"type\":\"Grid\"},{\"id\":\"1666396f-d1b2-4fc5-a443-3cf28dce8b3e\",\"type\":\"BoxAnnotation\"},{\"id\":\"476aa3ff-cf5d-4046-a5b7-882fc40b67cb\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"5575f20d-df99-431b-b21c-9c615f6a1e7d\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"3479048f-dced-4ff9-9ece-d65a89ad185a\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"951ff0a9-4332-4bbc-ac69-38e19f527491\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"e90f99fd-56b9-4dcd-9309-847d717741bc\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"8aea2d5d-91aa-4ca3-b1e8-d72a2ecb6d6c\",\"type\":\"DataRange1d\"}},\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":{\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"1661f8d7-8f69-4986-8ae4-d27094587657\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":0.5},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"e4f10ef6-b8a2-4d2b-870c-e0e675fba3f7\",\"type\":\"Patches\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1661f8d7-8f69-4986-8ae4-d27094587657\",\"type\":\"PanTool\"},{\"id\":\"2834fb9c-9a38-417f-a6e6-0f6343646da1\",\"type\":\"WheelZoomTool\"},{\"id\":\"79cef3ce-aaf7-43ca-9786-fb5474d42feb\",\"type\":\"BoxZoomTool\"},{\"id\":\"a28ee36f-d9f2-4c79-a424-ab7925e86692\",\"type\":\"ResetTool\"},{\"id\":\"e311de4e-7ad9-4042-a566-87e9f96715f4\",\"type\":\"HoverTool\"},{\"id\":\"e6b71c97-b5a3-4c0c-a51d-9ccd4daba35b\",\"type\":\"SaveTool\"}]},\"id\":\"951ff0a9-4332-4bbc-ac69-38e19f527491\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"a6b9b03b-ea67-4f2e-8569-5b1c71f276c2\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.7},\"fill_color\":{\"field\":\"objectid\",\"transform\":{\"id\":\"664d1cb0-712d-416a-a5ea-ef26f9f629d0\",\"type\":\"LinearColorMapper\"}},\"line_color\":{\"value\":\"white\"},\"line_width\":{\"value\":0.5},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"e2b9e847-a44e-411e-9fac-f8c5aa735f4a\",\"type\":\"Patches\"},{\"attributes\":{\"plot\":{\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"e6b71c97-b5a3-4c0c-a51d-9ccd4daba35b\",\"type\":\"SaveTool\"},{\"attributes\":{\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"a6b9b03b-ea67-4f2e-8569-5b1c71f276c2\",\"type\":\"BasicTicker\"}},\"id\":\"8167eab1-8b24-41c0-84e7-76027f270ea9\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"3479048f-dced-4ff9-9ece-d65a89ad185a\",\"type\":\"ToolEvents\"},{\"attributes\":{\"callback\":null,\"geojson\":\" {\\n \\\"type\\\": \\\"FeatureCollection\\\",\\n \\\"features\\\": [\\n\\n {\\n \\\"geometry\\\": {\\n \\\"type\\\": \\\"MultiPolygon\\\",\\n \\\"coordinates\\\": [\\n [\\n [\\n [\\n -59.68266601562502,\\n -52.231640624999976\\n ],\\n [\\n -59.74658203124997,\\n -52.25087890624999\\n ],\\n [\\n -59.76445312499996,\\n -52.2421875\\n ],\\n [\\n -59.784863281249955,\\n -52.2046875\\n ],\\n [\\n -59.78593749999999,\\n -52.156152343749966\\n ],\\n [\\n -59.79331054687498,\\n -52.134179687500016\\n ],\\n [\\n -59.75322265624999,\\n -52.14140624999998\\n ],\\n [\\n -59.681005859375034,\\n -52.18007812499995\\n ],\\n [\\n -59.68266601562502,\\n -52.231640624999976\\n ]\\n ]\\n ],\\n [\\n [\\n [\\n -58.438818359375006,\\n -52.011035156249974\\n ],\\n [\\n -58.432714843750006,\\n -52.09902343749996\\n ],\\n [\\n -58.512841796874966,\\n -52.071093750000045\\n ],\\n [\\n -58.54140625000002,\\n -52.02841796874996\\n ],\\n [\\n -58.49707031249997,\\n -51.99941406250001\\n ],\\n [\\n -58.46054687499998,\\n -52.0015625\\n ],\\n [\\n -58.438818359375006,\\n -52.011035156249974\\n ]\\n ]\\n ],\\n [\\n [\\n [\\n -61.01875,\\n -51.7857421875\\n ],\\n [\\n -60.94726562499997,\\n -51.79951171875005\\n ],\\n [\\n -60.87597656250003,\\n -51.79423828125004\\n ],\\n [\\n -60.91616210937494,\\n -51.89697265625001\\n ],\\n [\\n -60.94755859374996,\\n -51.94628906250002\\n ],\\n [\\n -61.031982421875,\\n -51.94248046875004\\n ],\\n [\\n -61.11577148437493,\\n -51.87529296875003\\n ],\\n [\\n -61.14501953125003,\\n -51.83945312500001\\n ],\\n [\\n -61.05166015625002,\\n -51.81396484374997\\n ],\\n [\\n -61.01875,\\n -51.7857421875\\n ]\\n ]\\n ],\\n [\\n [\\n [\\n -60.11171875000002,\\n -51.39589843749998\\n ],\\n [\\n -60.24882812499996,\\n -51.39599609375\\n ],\\n [\\n -60.27587890624997,\\n -51.36318359374997\\n ],\\n [\\n -60.275341796874955,\\n -51.28056640625002\\n ],\\n [\\n -60.17138671875,\\n -51.273437499999986\\n ],\\n [\\n -60.06982421875,\\n -51.307910156249996\\n ],\\n [\\n -60.07646484374993,\\n -51.34257812500004\\n ],\\n [\\n -60.11171875000002,\\n -51.39589843749998\\n ]\\n ]\\n ]\\n\\n ]\\n },\\n \\\"type\\\": \\\"Feature\\\",\\n \\\"properties\\\": {\\n \\\"perimeter\\\": 0,\\n \\\"vista\\\": \\\"mim\\\",\\n \\\"provincia\\\": \\\"Islas Malvinas\\\",\\n \\\"objectid\\\": 24,\\n \\\"prov\\\": 0,\\n \\\"bounds\\\": [\\n 0,\\n 0\\n ],\\n \\\"provif3_\\\": 27.0,\\n \\\"ogc_fid\\\": 26,\\n \\\"provif3_id\\\": 26.0\\n }\\n }\\n ]\\n }\"},\"id\":\"7abf13f9-e134-4648-bd08-9a7e62922f32\",\"type\":\"GeoJSONDataSource\"},{\"attributes\":{\"callback\":null},\"id\":\"e90f99fd-56b9-4dcd-9309-847d717741bc\",\"type\":\"DataRange1d\"},{\"attributes\":{\"plot\":{\"id\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"a28ee36f-d9f2-4c79-a424-ab7925e86692\",\"type\":\"ResetTool\"}],\"root_ids\":[\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.3\"}};\n",
" var render_items = [{\"docid\":\"3a7ce5bd-5a1f-416f-a74c-c701fc2d3bc2\",\"elementid\":\"2b0bf5c2-a194-414c-a419-da5df23656ef\",\"modelid\":\"e737dd77-63c7-4f63-ac50-b0f302bbddc3\"}];\n",
" \n",
" Bokeh.embed.embed_items(docs_json, render_items);\n",
" });\n",
" },\n",
" function(Bokeh) {\n",
" }\n",
" ];\n",
" \n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === \"1\")) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === \"1\") {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (!force) {\n",
" var cell = $(\"#2b0bf5c2-a194-414c-a419-da5df23656ef\").parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
" \n",
" }\n",
" \n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
" }(this));\n",
"</script>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"color_mapper = LinearColorMapper(palette=Viridis6)\n",
"\n",
"TOOLS = \"pan,wheel_zoom,box_zoom,reset,hover,save\"\n",
"\n",
"p = figure(title=\"Argentina\", tools=TOOLS, x_axis_location=None, y_axis_location=None, width=500, height=300)\n",
"p.grid.grid_line_color = None\n",
"\n",
"p.patches('xs', 'ys', fill_alpha=0.7, fill_color={'field': 'objectid', 'transform': color_mapper}, \n",
" line_color='white', line_width=0.5, source=geo_source)\n",
"\n",
"\n",
"hover = p.select_one(HoverTool)\n",
"hover.point_policy = \"follow_mouse\"\n",
"hover.tooltips = [\n",
" (\"Provincia:\", \"@provincia\")\n",
"]\n",
"\n",
"show(p)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.5"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment