Skip to content

Instantly share code, notes, and snippets.

@thvitt
Created November 29, 2017 17:32
Show Gist options
  • Save thvitt/2dd8019ed213ac21dfc67eb223d4f206 to your computer and use it in GitHub Desktop.
Save thvitt/2dd8019ed213ac21dfc67eb223d4f206 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"46f9f516-33f3-4db1-98d6-52af6f87e660\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(root) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = true;\n",
"\n",
" if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" root._bokeh_onload_callbacks = [];\n",
" root._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
" var JS_MIME_TYPE = 'application/javascript';\n",
" var HTML_MIME_TYPE = 'text/html';\n",
" var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
" var CLASS_NAME = 'output_bokeh rendered_html';\n",
"\n",
" /**\n",
" * Render data to the DOM node\n",
" */\n",
" function render(props, node) {\n",
" var script = document.createElement(\"script\");\n",
" node.appendChild(script);\n",
" }\n",
"\n",
" /**\n",
" * Handle when an output is cleared or removed\n",
" */\n",
" function handleClearOutput(event, handle) {\n",
" var cell = handle.cell;\n",
"\n",
" var id = cell.output_area._bokeh_element_id;\n",
" var server_id = cell.output_area._bokeh_server_id;\n",
" // Clean up Bokeh references\n",
" if (id !== undefined) {\n",
" Bokeh.index[id].model.document.clear();\n",
" delete Bokeh.index[id];\n",
" }\n",
"\n",
" if (server_id !== undefined) {\n",
" // Clean up Bokeh references\n",
" var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
" cell.notebook.kernel.execute(cmd, {\n",
" iopub: {\n",
" output: function(msg) {\n",
" var element_id = msg.content.text.trim();\n",
" Bokeh.index[element_id].model.document.clear();\n",
" delete Bokeh.index[element_id];\n",
" }\n",
" }\n",
" });\n",
" // Destroy server and session\n",
" var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
" cell.notebook.kernel.execute(cmd);\n",
" }\n",
" }\n",
"\n",
" /**\n",
" * Handle when a new output is added\n",
" */\n",
" function handleAddOutput(event, handle) {\n",
" var output_area = handle.output_area;\n",
" var output = handle.output;\n",
"\n",
" // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
" if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
" return\n",
" }\n",
"\n",
" var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
"\n",
" if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
" toinsert[0].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
" // store reference to embed id on output_area\n",
" output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
" }\n",
" if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
" var bk_div = document.createElement(\"div\");\n",
" bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
" var script_attrs = bk_div.children[0].attributes;\n",
" for (var i = 0; i < script_attrs.length; i++) {\n",
" toinsert[0].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
" }\n",
" // store reference to server id on output_area\n",
" output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
" }\n",
" }\n",
"\n",
" function register_renderer(events, OutputArea) {\n",
"\n",
" function append_mime(data, metadata, element) {\n",
" // create a DOM node to render to\n",
" var toinsert = this.create_output_subarea(\n",
" metadata,\n",
" CLASS_NAME,\n",
" EXEC_MIME_TYPE\n",
" );\n",
" this.keyboard_manager.register_events(toinsert);\n",
" // Render to node\n",
" var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
" render(props, toinsert[0]);\n",
" element.append(toinsert);\n",
" return toinsert\n",
" }\n",
"\n",
" /* Handle when an output is cleared or removed */\n",
" events.on('clear_output.CodeCell', handleClearOutput);\n",
" events.on('delete.Cell', handleClearOutput);\n",
"\n",
" /* Handle when a new output is added */\n",
" events.on('output_added.OutputArea', handleAddOutput);\n",
"\n",
" /**\n",
" * Register the mime type and append_mime function with output_area\n",
" */\n",
" OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
" /* Is output safe? */\n",
" safe: true,\n",
" /* Index of renderer in `output_area.display_order` */\n",
" index: 0\n",
" });\n",
" }\n",
"\n",
" // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
" if (root.Jupyter !== undefined) {\n",
" var events = require('base/js/events');\n",
" var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
"\n",
" if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
" register_renderer(events, OutputArea);\n",
" }\n",
" }\n",
"\n",
" \n",
" if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
" root._bokeh_timeout = Date.now() + 5000;\n",
" root._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",
" var el = document.getElementById(\"46f9f516-33f3-4db1-98d6-52af6f87e660\");\n",
" if (el != null) {\n",
" el.textContent = \"BokehJS is loading...\";\n",
" }\n",
" if (root.Bokeh !== undefined) {\n",
" if (el != null) {\n",
" el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
" }\n",
" } else if (Date.now() < root._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
"\n",
" function run_callbacks() {\n",
" try {\n",
" root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" }\n",
" finally {\n",
" delete root._bokeh_onload_callbacks\n",
" }\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" root._bokeh_onload_callbacks.push(callback);\n",
" if (root._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",
" root._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",
" root._bokeh_is_loading--;\n",
" if (root._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(\"46f9f516-33f3-4db1-98d6-52af6f87e660\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '46f9f516-33f3-4db1-98d6-52af6f87e660' 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.11.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.11.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.11.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.11.min.js\"];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.11.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.11.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.11.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.11.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.11.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.11.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((root.Bokeh !== undefined) || (force === true)) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i].call(root, root.Bokeh);\n",
" }if (force === true) {\n",
" display_loaded();\n",
" }} else if (Date.now() < root._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!root._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" root._bokeh_failed_load = true;\n",
" } else if (force !== true) {\n",
" var cell = $(document.getElementById(\"46f9f516-33f3-4db1-98d6-52af6f87e660\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (root._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",
"}(window));"
],
"application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._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 var el = document.getElementById(\"46f9f516-33f3-4db1-98d6-52af6f87e660\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._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 root._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 root._bokeh_is_loading--;\n if (root._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(\"46f9f516-33f3-4db1-98d6-52af6f87e660\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '46f9f516-33f3-4db1-98d6-52af6f87e660' 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.11.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.11.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.11.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.11.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.11.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.11.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.11.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.11.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.11.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.11.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"46f9f516-33f3-4db1-98d6-52af6f87e660\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._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}(window));"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"<div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"27bd80a1-e06f-4f23-812a-8b01f5b6d6ae\"></div>\n",
"</div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"(function(root) {\n",
" function embed_document(root) {\n",
" var docs_json = {\"512225ce-46b8-46ee-972d-0cd9dfa62de7\":{\"roots\":{\"references\":[{\"attributes\":{\"axis_label\":\"y\",\"formatter\":{\"id\":\"fdf54354-0331-456b-a761-7739c2814991\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"3b9d1731-5fb9-4ceb-91fd-ec3579d54710\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"fdd8b99d-2274-4b03-a404-dcfc1c8f8476\",\"type\":\"BasicTicker\"}},\"id\":\"d7520b9f-8b1a-461d-9802-a4090bc88469\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"fdd8b99d-2274-4b03-a404-dcfc1c8f8476\",\"type\":\"BasicTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"842894f4-86d1-4210-ac8c-358dbcdd7b6d\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"Temp.\"},\"renderers\":[{\"id\":\"484efd21-a366-4308-bef4-14661916a9f9\",\"type\":\"GlyphRenderer\"}]},\"id\":\"91186e2b-a21e-4106-b1be-af1c8d25f2f6\",\"type\":\"LegendItem\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"3b9d1731-5fb9-4ceb-91fd-ec3579d54710\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"fdd8b99d-2274-4b03-a404-dcfc1c8f8476\",\"type\":\"BasicTicker\"}},\"id\":\"ee06f4ac-dd13-416e-9cf4-fd8e0c4c7044\",\"type\":\"Grid\"},{\"attributes\":{\"below\":[{\"id\":\"aa2def57-bc35-4e82-bb28-018289e8ee0f\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"d7520b9f-8b1a-461d-9802-a4090bc88469\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"aa2def57-bc35-4e82-bb28-018289e8ee0f\",\"type\":\"LinearAxis\"},{\"id\":\"4acb778c-06c3-40e5-8677-61484d05dfb8\",\"type\":\"Grid\"},{\"id\":\"d7520b9f-8b1a-461d-9802-a4090bc88469\",\"type\":\"LinearAxis\"},{\"id\":\"ee06f4ac-dd13-416e-9cf4-fd8e0c4c7044\",\"type\":\"Grid\"},{\"id\":\"2a0e156a-55f2-42df-bdf1-bedea755f272\",\"type\":\"BoxAnnotation\"},{\"id\":\"9295f241-d0f6-475c-8edd-53ee9e63e992\",\"type\":\"Legend\"},{\"id\":\"484efd21-a366-4308-bef4-14661916a9f9\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"b26b741d-4294-41d8-9962-d7da96cf1213\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"76f03016-f725-437b-a2e0-dca4ddead3bd\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"88138437-1b45-4902-a947-7f4633d40b56\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"6746f3cf-2658-45f9-8913-ffbe11a62278\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"bd441618-9231-46d8-ba81-edeb76525388\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"7a9ff6b3-c686-43d6-b942-56b4aad7642d\",\"type\":\"LinearScale\"}},\"id\":\"3b9d1731-5fb9-4ceb-91fd-ec3579d54710\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"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\":\"2a0e156a-55f2-42df-bdf1-bedea755f272\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3e62fd22-940d-4efe-9a99-bb4bb2591ead\",\"type\":\"Line\"},{\"attributes\":{\"plot\":null,\"text\":\"simple line example\"},\"id\":\"b26b741d-4294-41d8-9962-d7da96cf1213\",\"type\":\"Title\"},{\"attributes\":{\"items\":[{\"id\":\"91186e2b-a21e-4106-b1be-af1c8d25f2f6\",\"type\":\"LegendItem\"}],\"plot\":{\"id\":\"3b9d1731-5fb9-4ceb-91fd-ec3579d54710\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"9295f241-d0f6-475c-8edd-53ee9e63e992\",\"type\":\"Legend\"},{\"attributes\":{\"source\":{\"id\":\"2e9dddd8-966c-4dda-8092-be40db031b36\",\"type\":\"ColumnDataSource\"}},\"id\":\"f5437798-504a-481a-9252-82316f14abe9\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"2e9dddd8-966c-4dda-8092-be40db031b36\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"3e62fd22-940d-4efe-9a99-bb4bb2591ead\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"842894f4-86d1-4210-ac8c-358dbcdd7b6d\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"f5437798-504a-481a-9252-82316f14abe9\",\"type\":\"CDSView\"}},\"id\":\"484efd21-a366-4308-bef4-14661916a9f9\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"8aa0a8d7-4bab-4180-a43b-01b787dbe962\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"6746f3cf-2658-45f9-8913-ffbe11a62278\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"408f3fb5-9f67-444c-99b4-3f1fcb4d7173\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"callback\":null},\"id\":\"88138437-1b45-4902-a947-7f4633d40b56\",\"type\":\"DataRange1d\"},{\"attributes\":{\"overlay\":{\"id\":\"2a0e156a-55f2-42df-bdf1-bedea755f272\",\"type\":\"BoxAnnotation\"}},\"id\":\"4311bdce-a2e2-47c5-9755-fe1d99881135\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"8aa0a8d7-4bab-4180-a43b-01b787dbe962\",\"type\":\"PanTool\"},{\"id\":\"408f3fb5-9f67-444c-99b4-3f1fcb4d7173\",\"type\":\"WheelZoomTool\"},{\"id\":\"4311bdce-a2e2-47c5-9755-fe1d99881135\",\"type\":\"BoxZoomTool\"},{\"id\":\"c1af0ba6-b0b9-4e02-be79-3b6fb2406204\",\"type\":\"SaveTool\"},{\"id\":\"bf2e8b08-dfc8-4d95-a19b-3a5a86e3e759\",\"type\":\"ResetTool\"},{\"id\":\"1e3316ad-7139-478b-a4fd-614a98052f99\",\"type\":\"HelpTool\"}]},\"id\":\"76f03016-f725-437b-a2e0-dca4ddead3bd\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"c1af0ba6-b0b9-4e02-be79-3b6fb2406204\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"bf2e8b08-dfc8-4d95-a19b-3a5a86e3e759\",\"type\":\"ResetTool\"},{\"attributes\":{\"callback\":null},\"id\":\"bd441618-9231-46d8-ba81-edeb76525388\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1e3316ad-7139-478b-a4fd-614a98052f99\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"7a9ff6b3-c686-43d6-b942-56b4aad7642d\",\"type\":\"LinearScale\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,2,4,5]}},\"id\":\"2e9dddd8-966c-4dda-8092-be40db031b36\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"fdf54354-0331-456b-a761-7739c2814991\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"f1025c6b-1841-4e57-b76c-76b271fb4504\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis_label\":\"x\",\"formatter\":{\"id\":\"f1025c6b-1841-4e57-b76c-76b271fb4504\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"3b9d1731-5fb9-4ceb-91fd-ec3579d54710\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"ff643190-6d8f-4201-9f5e-5c602bee5147\",\"type\":\"BasicTicker\"}},\"id\":\"aa2def57-bc35-4e82-bb28-018289e8ee0f\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"ff643190-6d8f-4201-9f5e-5c602bee5147\",\"type\":\"BasicTicker\"},{\"attributes\":{\"plot\":{\"id\":\"3b9d1731-5fb9-4ceb-91fd-ec3579d54710\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"ff643190-6d8f-4201-9f5e-5c602bee5147\",\"type\":\"BasicTicker\"}},\"id\":\"4acb778c-06c3-40e5-8677-61484d05dfb8\",\"type\":\"Grid\"}],\"root_ids\":[\"3b9d1731-5fb9-4ceb-91fd-ec3579d54710\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.11\"}};\n",
" var render_items = [{\"docid\":\"512225ce-46b8-46ee-972d-0cd9dfa62de7\",\"elementid\":\"27bd80a1-e06f-4f23-812a-8b01f5b6d6ae\",\"modelid\":\"3b9d1731-5fb9-4ceb-91fd-ec3579d54710\"}];\n",
" root.Bokeh.embed.embed_items(docs_json, render_items);\n",
" }\n",
" if (root.Bokeh !== undefined) {\n",
" embed_document(root);\n",
" } else {\n",
" var attempts = 0;\n",
" var timer = setInterval(function(root) {\n",
" if (root.Bokeh !== undefined) {\n",
" embed_document(root);\n",
" clearInterval(timer);\n",
" }\n",
" attempts++;\n",
" if (attempts > 100) {\n",
" console.log(\"Bokeh: ERROR: Unable to embed document because BokehJS library is missing\")\n",
" clearInterval(timer);\n",
" }\n",
" }, 10, root)\n",
" }\n",
"})(window);"
],
"application/vnd.bokehjs_exec.v0+json": ""
},
"metadata": {
"application/vnd.bokehjs_exec.v0+json": {
"id": "3b9d1731-5fb9-4ceb-91fd-ec3579d54710"
}
},
"output_type": "display_data"
}
],
"source": [
"from bokeh.plotting import figure, output_notebook, show\n",
"\n",
"# prepare some data\n",
"x = [1, 2, 3, 4, 5]\n",
"y = [6, 7, 2, 4, 5]\n",
"\n",
"# output to static HTML file\n",
"output_notebook()\n",
"\n",
"# create a new plot with a title and axis labels\n",
"p = figure(title=\"simple line example\", x_axis_label='x', y_axis_label='y')\n",
"\n",
"# add a line renderer with legend and line thickness\n",
"p.line(x, y, legend=\"Temp.\", line_width=2)\n",
"\n",
"# show the results\n",
"show(p)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# NBSphinx Bokeh Test documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 29 18:14:24 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['nbsphinx']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'NBSphinx Bokeh Test'
copyright = '2017, Thorsten Vitt'
author = 'Thorsten Vitt'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = ''
# The full version, including alpha/beta/rc tags.
release = ''
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'NBSphinxBokehTestdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'NBSphinxBokehTest.tex', 'NBSphinx Bokeh Test Documentation',
'Thorsten Vitt', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'nbsphinxbokehtest', 'NBSphinx Bokeh Test Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'NBSphinxBokehTest', 'NBSphinx Bokeh Test Documentation',
author, 'NBSphinxBokehTest', 'One line description of project.',
'Miscellaneous'),
]
jupyter==1.0.0
nbsphinx==0.2.17
bokeh==0.12.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment