Created
October 26, 2016 08:35
-
-
Save RutgerK/526057a3622395fa0a2bb33b115d5487 to your computer and use it in GitHub Desktop.
Bokeh heatmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 45, | |
"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=\"3253c01b-eeac-4800-a11f-3578ff1df0d7\">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.$(\"#3253c01b-eeac-4800-a11f-3578ff1df0d7\").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(\"3253c01b-eeac-4800-a11f-3578ff1df0d7\");\n", | |
" if (element == null) {\n", | |
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '3253c01b-eeac-4800-a11f-3578ff1df0d7' 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.$(\"#3253c01b-eeac-4800-a11f-3578ff1df0d7\").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 = $(\"#3253c01b-eeac-4800-a11f-3578ff1df0d7\").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 output_notebook, show\n", | |
"from bokeh.plotting import figure\n", | |
"from bokeh.charts import HeatMap\n", | |
"from datetime import datetime\n", | |
"\n", | |
"output_notebook()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 46, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"\n", | |
"\n", | |
" <div class=\"bk-root\">\n", | |
" <div class=\"plotdiv\" id=\"40c8d4e5-91e7-4ad6-bd8f-1f67b47ead3f\"></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.$(\"#40c8d4e5-91e7-4ad6-bd8f-1f67b47ead3f\").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(\"40c8d4e5-91e7-4ad6-bd8f-1f67b47ead3f\");\n", | |
" if (element == null) {\n", | |
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '40c8d4e5-91e7-4ad6-bd8f-1f67b47ead3f' 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 = {\"9d67e117-29c3-4802-b3d2-015c6adedead\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"a1edcf53-bd3a-47cb-bd5c-09aaa0ed31ef\",\"type\":\"CategoricalAxis\"}],\"left\":[{\"id\":\"cfa3780b-ef74-471e-a549-0946145d23e4\",\"type\":\"CategoricalAxis\"}],\"renderers\":[{\"id\":\"fd28630d-8c81-4b92-952d-eb3c3caeebc4\",\"type\":\"BoxAnnotation\"},{\"id\":\"ef5f00b4-1bae-4e6f-9719-cbaa7834d1ed\",\"type\":\"GlyphRenderer\"},{\"id\":\"7ea75e96-2c9f-4bf0-aac7-1d7f3e0c4aca\",\"type\":\"GlyphRenderer\"},{\"id\":\"0a3057ce-a71b-44b9-94e4-7e22ad19e7a1\",\"type\":\"GlyphRenderer\"},{\"id\":\"3e8589f6-bc1d-42f0-b5a1-153f7c03f874\",\"type\":\"GlyphRenderer\"},{\"id\":\"41cc6a51-5b5d-4f58-9bda-99b1baabcd6b\",\"type\":\"GlyphRenderer\"},{\"id\":\"a6a85824-eb55-4b7f-9915-220e2e6132a9\",\"type\":\"GlyphRenderer\"},{\"id\":\"4363c6c7-2c8f-4a9b-b9a6-7ff1325982df\",\"type\":\"Legend\"},{\"id\":\"a1edcf53-bd3a-47cb-bd5c-09aaa0ed31ef\",\"type\":\"CategoricalAxis\"},{\"id\":\"cfa3780b-ef74-471e-a549-0946145d23e4\",\"type\":\"CategoricalAxis\"}],\"title\":{\"id\":\"23b60876-3d5b-4143-98c7-8df190d4ed35\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"caac7186-b3bb-41d7-8917-b271a32a0060\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"4ef15d5b-d9e8-4af7-82eb-4b4a6757f69e\",\"type\":\"Toolbar\"},\"x_mapper_type\":\"auto\",\"x_range\":{\"id\":\"b8076ef8-4606-4c5b-b811-923ec0d55fc4\",\"type\":\"FactorRange\"},\"y_mapper_type\":\"auto\",\"y_range\":{\"id\":\"98552d91-3762-4b25-b84d-6f4670927ed8\",\"type\":\"FactorRange\"}},\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"},{\"attributes\":{\"label\":{\"value\":\"(3.5, 4.3]\"},\"renderers\":[{\"id\":\"0a3057ce-a71b-44b9-94e4-7e22ad19e7a1\",\"type\":\"GlyphRenderer\"}]},\"id\":\"3fce00ec-e41b-4451-80a4-c0feda8bae2b\",\"type\":\"LegendItem\"},{\"attributes\":{\"data_source\":{\"id\":\"659b498c-d34a-45cf-8293-427c78250e8e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"5d6bc13a-6404-42e7-9dd9-5d80efcdd2a1\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"ef5f00b4-1bae-4e6f-9719-cbaa7834d1ed\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"6b98d208-5355-438a-8097-6684299e9920\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"values\",\"x\"],\"data\":{\"chart_index\":[{\"value\":\"(3.5, 4.3]\"}],\"value\":[\"(3.5, 4.3]\"],\"values\":[4],\"x\":[\"2016-10-25 0000\"],\"y\":[\"param2\"]}},\"id\":\"26540d8d-6b94-4632-886c-f7c7e8d5435a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"dilate\":true,\"fill_color\":{\"value\":\"#3182bd\"},\"height\":{\"units\":\"data\",\"value\":0.95},\"line_color\":{\"value\":\"#3182bd\"},\"width\":{\"units\":\"data\",\"value\":0.95},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"6a4827a0-e775-4d99-88e9-5217533e42b3\",\"type\":\"Rect\"},{\"attributes\":{\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"173c2840-9b9a-481b-9efb-f52fe0ea751f\",\"type\":\"ResetTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"values\",\"x\"],\"data\":{\"chart_index\":[{\"value\":\"[1, 1.8]\"}],\"value\":[\"[1, 1.8]\"],\"values\":[1],\"x\":[\"2016-10-25 0000\"],\"y\":[\"param1\"]}},\"id\":\"c8fd1c06-0a53-4871-804c-c0e60f2aced7\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"9ff67f4f-399f-417c-bcac-274ab78c073b\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"26540d8d-6b94-4632-886c-f7c7e8d5435a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"8fa8023d-6681-4195-9f5f-e932093361a1\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"0a3057ce-a71b-44b9-94e4-7e22ad19e7a1\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":null,\"text\":null},\"id\":\"23b60876-3d5b-4143-98c7-8df190d4ed35\",\"type\":\"Title\"},{\"attributes\":{\"label\":{\"value\":\"(2.7, 3.5]\"},\"renderers\":[{\"id\":\"3e8589f6-bc1d-42f0-b5a1-153f7c03f874\",\"type\":\"GlyphRenderer\"}]},\"id\":\"a184ba72-46f0-4bae-acba-e984edbf22a4\",\"type\":\"LegendItem\"},{\"attributes\":{\"dilate\":true,\"fill_color\":{\"value\":\"#eff3ff\"},\"height\":{\"units\":\"data\",\"value\":0.95},\"line_color\":{\"value\":\"#eff3ff\"},\"width\":{\"units\":\"data\",\"value\":0.95},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"20a30d22-41c6-436f-bc05-c9ca7c268e5b\",\"type\":\"Rect\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"6b98d208-5355-438a-8097-6684299e9920\",\"type\":\"PanTool\"},{\"id\":\"0535a954-6227-44da-ab30-518dbb3eb0a8\",\"type\":\"WheelZoomTool\"},{\"id\":\"882c5f50-1b48-48a5-b47f-f167a3467197\",\"type\":\"BoxZoomTool\"},{\"id\":\"81c12ada-7d02-45c4-aebc-163d650fa8bf\",\"type\":\"SaveTool\"},{\"id\":\"173c2840-9b9a-481b-9efb-f52fe0ea751f\",\"type\":\"ResetTool\"},{\"id\":\"1080e4bf-0d71-462a-ac99-41f1e57c30df\",\"type\":\"HelpTool\"}]},\"id\":\"4ef15d5b-d9e8-4af7-82eb-4b4a6757f69e\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"values\",\"x\"],\"data\":{\"chart_index\":[{\"value\":\"(4.3, 5.2]\"}],\"value\":[\"(4.3, 5.2]\"],\"values\":[5],\"x\":[\"2016-10-25 0800\"],\"y\":[\"param2\"]}},\"id\":\"cf0763c2-6667-42b5-a974-c63e19780a62\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"label\":{\"value\":\"[1, 1.8]\"},\"renderers\":[{\"id\":\"a6a85824-eb55-4b7f-9915-220e2e6132a9\",\"type\":\"GlyphRenderer\"}]},\"id\":\"4e100e6a-090a-41c2-a47b-5dff2c12ca3a\",\"type\":\"LegendItem\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"values\",\"x\"],\"data\":{\"chart_index\":[{\"value\":\"(5.2, 6]\"}],\"value\":[\"(5.2, 6]\"],\"values\":[6],\"x\":[\"2016-10-25 1600\"],\"y\":[\"param2\"]}},\"id\":\"659b498c-d34a-45cf-8293-427c78250e8e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"dilate\":true,\"fill_color\":{\"value\":\"#08519c\"},\"height\":{\"units\":\"data\",\"value\":0.95},\"line_color\":{\"value\":\"#08519c\"},\"width\":{\"units\":\"data\",\"value\":0.95},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"5d6bc13a-6404-42e7-9dd9-5d80efcdd2a1\",\"type\":\"Rect\"},{\"attributes\":{\"items\":[{\"id\":\"9d7f1392-4e3b-4c72-8b36-7c5447480c36\",\"type\":\"LegendItem\"},{\"id\":\"7848b1a5-019b-4231-9220-e36acad4a604\",\"type\":\"LegendItem\"},{\"id\":\"3fce00ec-e41b-4451-80a4-c0feda8bae2b\",\"type\":\"LegendItem\"},{\"id\":\"a184ba72-46f0-4bae-acba-e984edbf22a4\",\"type\":\"LegendItem\"},{\"id\":\"161841c2-6069-402b-90d7-3d9646d6f8e9\",\"type\":\"LegendItem\"},{\"id\":\"4e100e6a-090a-41c2-a47b-5dff2c12ca3a\",\"type\":\"LegendItem\"}],\"location\":\"top_left\",\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"4363c6c7-2c8f-4a9b-b9a6-7ff1325982df\",\"type\":\"Legend\"},{\"attributes\":{\"dilate\":true,\"fill_color\":{\"value\":\"#c6dbef\"},\"height\":{\"units\":\"data\",\"value\":0.95},\"line_color\":{\"value\":\"#c6dbef\"},\"width\":{\"units\":\"data\",\"value\":0.95},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3cd6d22c-00f9-4ad3-a6fa-67030e8588ad\",\"type\":\"Rect\"},{\"attributes\":{\"dilate\":true,\"fill_color\":{\"value\":\"#9ecae1\"},\"height\":{\"units\":\"data\",\"value\":0.95},\"line_color\":{\"value\":\"#9ecae1\"},\"width\":{\"units\":\"data\",\"value\":0.95},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"d7b4f323-86d6-4298-8dbf-a05371885947\",\"type\":\"Rect\"},{\"attributes\":{\"axis_label\":\"y\",\"formatter\":{\"id\":\"8cde3d41-99d4-4c13-8f40-4819aac77a74\",\"type\":\"CategoricalTickFormatter\"},\"major_label_orientation\":0.7853981633974483,\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"9ff67f4f-399f-417c-bcac-274ab78c073b\",\"type\":\"CategoricalTicker\"}},\"id\":\"cfa3780b-ef74-471e-a549-0946145d23e4\",\"type\":\"CategoricalAxis\"},{\"attributes\":{},\"id\":\"8cde3d41-99d4-4c13-8f40-4819aac77a74\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"c8fd1c06-0a53-4871-804c-c0e60f2aced7\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"20a30d22-41c6-436f-bc05-c9ca7c268e5b\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"a6a85824-eb55-4b7f-9915-220e2e6132a9\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"factors\":[\"param1\",\"param2\"]},\"id\":\"98552d91-3762-4b25-b84d-6f4670927ed8\",\"type\":\"FactorRange\"},{\"attributes\":{\"data_source\":{\"id\":\"cf0763c2-6667-42b5-a974-c63e19780a62\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"6a4827a0-e775-4d99-88e9-5217533e42b3\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"7ea75e96-2c9f-4bf0-aac7-1d7f3e0c4aca\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"a77fc01e-0943-49e1-a9a8-6e472c6f5394\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{},\"id\":\"88126086-9ee5-4c53-836f-000635dd8828\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"dilate\":true,\"fill_color\":{\"value\":\"#6baed6\"},\"height\":{\"units\":\"data\",\"value\":0.95},\"line_color\":{\"value\":\"#6baed6\"},\"width\":{\"units\":\"data\",\"value\":0.95},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"8fa8023d-6681-4195-9f5f-e932093361a1\",\"type\":\"Rect\"},{\"attributes\":{\"data_source\":{\"id\":\"b0e6119a-3ef9-4879-8a83-0305cc8b05e4\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"3cd6d22c-00f9-4ad3-a6fa-67030e8588ad\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"41cc6a51-5b5d-4f58-9bda-99b1baabcd6b\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"1080e4bf-0d71-462a-ac99-41f1e57c30df\",\"type\":\"HelpTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"values\",\"x\"],\"data\":{\"chart_index\":[{\"value\":\"(1.8, 2.7]\"}],\"value\":[\"(1.8, 2.7]\"],\"values\":[2],\"x\":[\"2016-10-25 0800\"],\"y\":[\"param1\"]}},\"id\":\"b0e6119a-3ef9-4879-8a83-0305cc8b05e4\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"caac7186-b3bb-41d7-8917-b271a32a0060\",\"type\":\"ToolEvents\"},{\"attributes\":{\"label\":{\"value\":\"(4.3, 5.2]\"},\"renderers\":[{\"id\":\"7ea75e96-2c9f-4bf0-aac7-1d7f3e0c4aca\",\"type\":\"GlyphRenderer\"}]},\"id\":\"7848b1a5-019b-4231-9220-e36acad4a604\",\"type\":\"LegendItem\"},{\"attributes\":{\"label\":{\"value\":\"(1.8, 2.7]\"},\"renderers\":[{\"id\":\"41cc6a51-5b5d-4f58-9bda-99b1baabcd6b\",\"type\":\"GlyphRenderer\"}]},\"id\":\"161841c2-6069-402b-90d7-3d9646d6f8e9\",\"type\":\"LegendItem\"},{\"attributes\":{\"overlay\":{\"id\":\"fd28630d-8c81-4b92-952d-eb3c3caeebc4\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"882c5f50-1b48-48a5-b47f-f167a3467197\",\"type\":\"BoxZoomTool\"},{\"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\":\"fd28630d-8c81-4b92-952d-eb3c3caeebc4\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"callback\":null,\"factors\":[\"2016-10-25 0000\",\"2016-10-25 0800\",\"2016-10-25 1600\"]},\"id\":\"b8076ef8-4606-4c5b-b811-923ec0d55fc4\",\"type\":\"FactorRange\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"values\",\"x\"],\"data\":{\"chart_index\":[{\"value\":\"(2.7, 3.5]\"}],\"value\":[\"(2.7, 3.5]\"],\"values\":[3],\"x\":[\"2016-10-25 1600\"],\"y\":[\"param1\"]}},\"id\":\"d1952a8d-a0ed-42fc-835b-a2a014178b62\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"0535a954-6227-44da-ab30-518dbb3eb0a8\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"axis_label\":\"x\",\"formatter\":{\"id\":\"a77fc01e-0943-49e1-a9a8-6e472c6f5394\",\"type\":\"CategoricalTickFormatter\"},\"major_label_orientation\":0.7853981633974483,\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"88126086-9ee5-4c53-836f-000635dd8828\",\"type\":\"CategoricalTicker\"}},\"id\":\"a1edcf53-bd3a-47cb-bd5c-09aaa0ed31ef\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"label\":{\"value\":\"(5.2, 6]\"},\"renderers\":[{\"id\":\"ef5f00b4-1bae-4e6f-9719-cbaa7834d1ed\",\"type\":\"GlyphRenderer\"}]},\"id\":\"9d7f1392-4e3b-4c72-8b36-7c5447480c36\",\"type\":\"LegendItem\"},{\"attributes\":{\"data_source\":{\"id\":\"d1952a8d-a0ed-42fc-835b-a2a014178b62\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"d7b4f323-86d6-4298-8dbf-a05371885947\",\"type\":\"Rect\"},\"hover_glyph\":null,\"nonselection_glyph\":null,\"selection_glyph\":null},\"id\":\"3e8589f6-bc1d-42f0-b5a1-153f7c03f874\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\",\"subtype\":\"Chart\",\"type\":\"Plot\"}},\"id\":\"81c12ada-7d02-45c4-aebc-163d650fa8bf\",\"type\":\"SaveTool\"}],\"root_ids\":[\"c9624c01-8728-481a-8f2f-bf67eece81a9\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.3\"}};\n", | |
" var render_items = [{\"docid\":\"9d67e117-29c3-4802-b3d2-015c6adedead\",\"elementid\":\"40c8d4e5-91e7-4ad6-bd8f-1f67b47ead3f\",\"modelid\":\"c9624c01-8728-481a-8f2f-bf67eece81a9\"}];\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 = $(\"#40c8d4e5-91e7-4ad6-bd8f-1f67b47ead3f\").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": [ | |
"data = {\n", | |
" 'value': [1, 2, 3, 4, 5, 6],\n", | |
" 'x': [datetime(2016, 10, 25, 0, 0),\n", | |
" datetime(2016, 10, 25, 8, 0),\n", | |
" datetime(2016, 10, 25, 16, 0),\n", | |
" datetime(2016, 10, 25, 0, 0),\n", | |
" datetime(2016, 10, 25, 8, 0),\n", | |
" datetime(2016, 10, 25, 16, 0)],\n", | |
" 'y': ['param1', 'param1', 'param1', 'param2', 'param2', 'param2']\n", | |
"}\n", | |
"data['x'] = [x.strftime('%Y-%m-%d %H%M') for x in data['x']]\n", | |
"hm = HeatMap(data, x='x', y='y', values='value', stat=None)\n", | |
"\n", | |
"show(hm)" | |
] | |
}, | |
{ | |
"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