{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Creating a bullet graph using Bokeh\n", "\n", "This is the notebook associated with the article at [Pbpython.com](http://pbpython.com/bokeh-bullet-waterfall.html)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from bokeh.io import show, output_notebook\n", "from bokeh.palettes import PuBu4\n", "from bokeh.plotting import figure\n", "from bokeh.models import Label" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " Loading BokehJS ...\n", "
" ] }, "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[toinsert.length - 1].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[toinsert.length - 1].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[toinsert.length - 1]);\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", " \"
\\n\"+\n", " \"

\\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", " \"

\\n\"+\n", " \"\\n\"+\n", " \"\\n\"+\n", " \"from bokeh.resources import INLINE\\n\"+\n", " \"output_notebook(resources=INLINE)\\n\"+\n", " \"\\n\"+\n", " \"
\"}};\n", "\n", " function display_loaded() {\n", " var el = document.getElementById(\"2635364d-431d-42ef-b4ee-b905236cc8ef\");\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(\"2635364d-431d-42ef-b4ee-b905236cc8ef\");\n", " if (element == null) {\n", " console.log(\"Bokeh: ERROR: autoload.js configured with elementid '2635364d-431d-42ef-b4ee-b905236cc8ef' 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.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.15.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.15.min.css\");\n", " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.15.min.css\");\n", " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.css\");\n", " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.css\");\n", " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.css\");\n", " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.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(\"2635364d-431d-42ef-b4ee-b905236cc8ef\")).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 \"
\\n\"+\n \"

\\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 \"

\\n\"+\n \"\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"\\n\"+\n \"
\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"2635364d-431d-42ef-b4ee-b905236cc8ef\");\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(\"2635364d-431d-42ef-b4ee-b905236cc8ef\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '2635364d-431d-42ef-b4ee-b905236cc8ef' 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.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.15.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.15.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.15.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.15.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.15.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(\"2635364d-431d-42ef-b4ee-b905236cc8ef\")).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" } ], "source": [ "output_notebook()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Load in the data\n", "data= [(\"John Smith\", 105, 120),\n", " (\"Jane Jones\", 99, 110),\n", " (\"Fred Flintstone\", 109, 125),\n", " (\"Barney Rubble\", 135, 123),\n", " (\"Mr T\", 45, 105)]\n", "\n", "limits = [0, 20, 60, 100, 160]\n", "labels = [\"Poor\", \"OK\", \"Good\", \"Excellent\"]\n", "cats = [x[0] for x in data]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Create the base figure\n", "p=figure(title=\"Sales Rep Performance\", plot_height=350, plot_width=800, y_range=cats)\n", "p.x_range.range_padding = 0\n", "p.grid.grid_line_color = None\n", "p.xaxis[0].ticker.num_minor_ticks = 0" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[(0, 20, '#f1eef6'), (20, 60, '#bdc9e1'), (60, 100, '#74a9cf'), (100, 160, '#0570b0')]\n" ] } ], "source": [ "# Here's the format of the data we need\n", "print(list(zip(limits[:-1], limits[1:], PuBu4[::-1])))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "for left, right, color in zip(limits[:-1], limits[1:], PuBu4[::-1]):\n", " p.hbar(y=cats, left=left, right=right, height=0.8, color=color)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "(function(root) {\n", " function embed_document(root) {\n", " \n", " var docs_json = {\"eef8804d-cebd-42ec-ae64-4bc95ddcde50\":{\"roots\":{\"references\":[{\"attributes\":{\"source\":{\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"}},\"id\":\"5f6e25e9-323e-4cc3-b15b-be7ad4751f1c\",\"type\":\"CDSView\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"}},\"id\":\"0a6bb0f2-941a-4f6c-a317-9b8074dc94b7\",\"type\":\"Grid\"},{\"attributes\":{\"fill_color\":{\"value\":\"#74a9cf\"},\"height\":{\"value\":0.8},\"left\":{\"value\":60},\"line_color\":{\"value\":\"#74a9cf\"},\"right\":{\"value\":100},\"y\":{\"field\":\"y\"}},\"id\":\"d2f85c2d-a268-46c7-ab0a-a24ffad15610\",\"type\":\"HBar\"},{\"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\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":60},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":100},\"y\":{\"field\":\"y\"}},\"id\":\"5de1f8c1-e63f-4e47-87eb-68dea6376b37\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"34dc53ec-7c6a-44e2-a9bc-e76cac542ca7\",\"type\":\"CategoricalTickFormatter\"},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"}},\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"d2f85c2d-a268-46c7-ab0a-a24ffad15610\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"5de1f8c1-e63f-4e47-87eb-68dea6376b37\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"774a4509-797b-42f5-bf06-470954774c7c\",\"type\":\"CDSView\"}},\"id\":\"5e38d20a-a939-46a1-91cc-988ca23d2b72\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"31b77228-0194-43b3-8285-40beaa7b39a2\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_color\":{\"value\":\"#f1eef6\"},\"height\":{\"value\":0.8},\"line_color\":{\"value\":\"#f1eef6\"},\"right\":{\"value\":20},\"y\":{\"field\":\"y\"}},\"id\":\"23621143-b8f1-4317-be08-34a588f87f92\",\"type\":\"HBar\"},{\"attributes\":{\"source\":{\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"}},\"id\":\"774a4509-797b-42f5-bf06-470954774c7c\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_color\":{\"value\":\"#0570b0\"},\"height\":{\"value\":0.8},\"left\":{\"value\":100},\"line_color\":{\"value\":\"#0570b0\"},\"right\":{\"value\":160},\"y\":{\"field\":\"y\"}},\"id\":\"0f634aad-fef1-4da5-8485-b7de17593be9\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"2f63bb8f-56d7-44dc-8dc8-9c220e0a07a4\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":100},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":160},\"y\":{\"field\":\"y\"}},\"id\":\"1bdbaf64-4ab3-4b1c-a703-2b4cdd51a219\",\"type\":\"HBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":20},\"y\":{\"field\":\"y\"}},\"id\":\"6386f34e-c85d-4473-adbe-7681bf6d7ac1\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"65269a41-7a1f-4d29-a894-471710ff8c6e\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"0f634aad-fef1-4da5-8485-b7de17593be9\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1bdbaf64-4ab3-4b1c-a703-2b4cdd51a219\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"b2a285a8-8009-42d8-84e6-570227a7c371\",\"type\":\"CDSView\"}},\"id\":\"d280d2f9-8e67-47aa-9773-90b055196e0a\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"34dc53ec-7c6a-44e2-a9bc-e76cac542ca7\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"}},\"id\":\"175772bc-b6dd-4481-bfe7-32a2f2199020\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"}},\"id\":\"b2a285a8-8009-42d8-84e6-570227a7c371\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"}},\"id\":\"51146cbe-b2db-4fbc-a213-92656eac8785\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"num_minor_ticks\":0},\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"23621143-b8f1-4317-be08-34a588f87f92\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"6386f34e-c85d-4473-adbe-7681bf6d7ac1\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"ac29c9fd-0ed1-4491-b149-32bbe6a2fc7b\",\"type\":\"CDSView\"}},\"id\":\"f6f2006d-a9a0-4f1a-a58f-1c92f0090cf3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"31b77228-0194-43b3-8285-40beaa7b39a2\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"}},\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"d581a3c9-f86b-458c-8f04-b4f10494b97f\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"8f6e5add-ac6f-424b-a305-fb18c3ee039d\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"132cea88-1051-4597-bb86-45986e2ae737\",\"type\":\"HelpTool\"},{\"attributes\":{\"source\":{\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"}},\"id\":\"ac29c9fd-0ed1-4491-b149-32bbe6a2fc7b\",\"type\":\"CDSView\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"below\":[{\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"}],\"plot_height\":350,\"plot_width\":800,\"renderers\":[{\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"},{\"id\":\"175772bc-b6dd-4481-bfe7-32a2f2199020\",\"type\":\"Grid\"},{\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"},{\"id\":\"0a6bb0f2-941a-4f6c-a317-9b8074dc94b7\",\"type\":\"Grid\"},{\"id\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"},{\"id\":\"f6f2006d-a9a0-4f1a-a58f-1c92f0090cf3\",\"type\":\"GlyphRenderer\"},{\"id\":\"7564abb5-3afa-4be6-872a-0f7364d57e98\",\"type\":\"GlyphRenderer\"},{\"id\":\"5e38d20a-a939-46a1-91cc-988ca23d2b72\",\"type\":\"GlyphRenderer\"},{\"id\":\"d280d2f9-8e67-47aa-9773-90b055196e0a\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"5f2a51c9-8834-4321-a726-ad4745c1e49a\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"f963482c-d806-412f-b20b-0704754bde06\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"3a7d2eae-34fd-4099-8058-10909276bcb3\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"37f43edc-663e-44aa-b335-1ac1452b5a4b\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"0f17fc0a-3fc1-4991-9e63-90158fc0fc26\",\"type\":\"FactorRange\"},\"y_scale\":{\"id\":\"7496bf3b-691a-403f-b62b-525c4f1a1ebf\",\"type\":\"CategoricalScale\"}},\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":null,\"text\":\"Sales Rep Performance\"},\"id\":\"5f2a51c9-8834-4321-a726-ad4745c1e49a\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"7496bf3b-691a-403f-b62b-525c4f1a1ebf\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"range_padding\":0},\"id\":\"3a7d2eae-34fd-4099-8058-10909276bcb3\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data_source\":{\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"39d7b951-2cda-4b72-9cdd-178e2788bc0a\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"11532321-cbd2-48c7-96ca-091f96ffcb79\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"5f6e25e9-323e-4cc3-b15b-be7ad4751f1c\",\"type\":\"CDSView\"}},\"id\":\"7564abb5-3afa-4be6-872a-0f7364d57e98\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"factors\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"id\":\"0f17fc0a-3fc1-4991-9e63-90158fc0fc26\",\"type\":\"FactorRange\"},{\"attributes\":{\"fill_color\":{\"value\":\"#bdc9e1\"},\"height\":{\"value\":0.8},\"left\":{\"value\":20},\"line_color\":{\"value\":\"#bdc9e1\"},\"right\":{\"value\":60},\"y\":{\"field\":\"y\"}},\"id\":\"39d7b951-2cda-4b72-9cdd-178e2788bc0a\",\"type\":\"HBar\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2f63bb8f-56d7-44dc-8dc8-9c220e0a07a4\",\"type\":\"PanTool\"},{\"id\":\"65269a41-7a1f-4d29-a894-471710ff8c6e\",\"type\":\"WheelZoomTool\"},{\"id\":\"51146cbe-b2db-4fbc-a213-92656eac8785\",\"type\":\"BoxZoomTool\"},{\"id\":\"d581a3c9-f86b-458c-8f04-b4f10494b97f\",\"type\":\"SaveTool\"},{\"id\":\"8f6e5add-ac6f-424b-a305-fb18c3ee039d\",\"type\":\"ResetTool\"},{\"id\":\"132cea88-1051-4597-bb86-45986e2ae737\",\"type\":\"HelpTool\"}]},\"id\":\"f963482c-d806-412f-b20b-0704754bde06\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"37f43edc-663e-44aa-b335-1ac1452b5a4b\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":20},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":60},\"y\":{\"field\":\"y\"}},\"id\":\"11532321-cbd2-48c7-96ca-091f96ffcb79\",\"type\":\"HBar\"}],\"root_ids\":[\"666eb784-dc29-4e39-a981-12ca3eef6744\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.15\"}};\n", " var render_items = [{\"docid\":\"eef8804d-cebd-42ec-ae64-4bc95ddcde50\",\"elementid\":\"c6fbe74e-4e0d-4358-ad9a-813f9c885222\",\"modelid\":\"666eb784-dc29-4e39-a981-12ca3eef6744\"}];\n", " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", "\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 run BokehJS code 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": "666eb784-dc29-4e39-a981-12ca3eef6744" } }, "output_type": "display_data" } ], "source": [ "show(p)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
GlyphRenderer(
id = 'b74dd2be-5247-49c2-8f91-74b8b95b65c3', …)
data_source = ColumnDataSource(id='16e81a84-0e42-40bc-b65c-052d37b77e4a', ...),
glyph = HBar(id='b9dc72ae-b295-4fd6-add7-d805fa6e381a', ...),
hover_glyph = None,
js_event_callbacks = {},
js_property_callbacks = {},
level = 'glyph',
muted = False,
muted_glyph = None,
name = None,
nonselection_glyph = HBar(id='0e6796bb-e53e-48aa-bd0f-594b9a3f83df', ...),
selection_glyph = None,
subscribed_events = [],
tags = [],
view = CDSView(id='e241765e-3b5a-4be2-af7e-984e7aa9a21e', ...),
visible = True,
x_range_name = 'default',
y_range_name = 'default')
\n", "\n" ], "text/plain": [ "GlyphRenderer(id='b74dd2be-5247-49c2-8f91-74b8b95b65c3', ...)" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Now add the black bars for the actual performance\n", "perf = [x[1] for x in data]\n", "p.hbar(y=cats, left=0, right=perf, height=0.3, color=\"black\")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "(function(root) {\n", " function embed_document(root) {\n", " \n", " var docs_json = {\"6cf75f4a-ef1a-40fc-ab19-6d3c39ccc24a\":{\"roots\":{\"references\":[{\"attributes\":{\"source\":{\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"}},\"id\":\"5f6e25e9-323e-4cc3-b15b-be7ad4751f1c\",\"type\":\"CDSView\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"}},\"id\":\"0a6bb0f2-941a-4f6c-a317-9b8074dc94b7\",\"type\":\"Grid\"},{\"attributes\":{\"fill_color\":{\"value\":\"#74a9cf\"},\"height\":{\"value\":0.8},\"left\":{\"value\":60},\"line_color\":{\"value\":\"#74a9cf\"},\"right\":{\"value\":100},\"y\":{\"field\":\"y\"}},\"id\":\"d2f85c2d-a268-46c7-ab0a-a24ffad15610\",\"type\":\"HBar\"},{\"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\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":60},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":100},\"y\":{\"field\":\"y\"}},\"id\":\"5de1f8c1-e63f-4e47-87eb-68dea6376b37\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"34dc53ec-7c6a-44e2-a9bc-e76cac542ca7\",\"type\":\"CategoricalTickFormatter\"},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"}},\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"d2f85c2d-a268-46c7-ab0a-a24ffad15610\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"5de1f8c1-e63f-4e47-87eb-68dea6376b37\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"774a4509-797b-42f5-bf06-470954774c7c\",\"type\":\"CDSView\"}},\"id\":\"5e38d20a-a939-46a1-91cc-988ca23d2b72\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"31b77228-0194-43b3-8285-40beaa7b39a2\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_color\":{\"value\":\"#f1eef6\"},\"height\":{\"value\":0.8},\"line_color\":{\"value\":\"#f1eef6\"},\"right\":{\"value\":20},\"y\":{\"field\":\"y\"}},\"id\":\"23621143-b8f1-4317-be08-34a588f87f92\",\"type\":\"HBar\"},{\"attributes\":{\"source\":{\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"}},\"id\":\"774a4509-797b-42f5-bf06-470954774c7c\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_color\":{\"value\":\"#0570b0\"},\"height\":{\"value\":0.8},\"left\":{\"value\":100},\"line_color\":{\"value\":\"#0570b0\"},\"right\":{\"value\":160},\"y\":{\"field\":\"y\"}},\"id\":\"0f634aad-fef1-4da5-8485-b7de17593be9\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"2f63bb8f-56d7-44dc-8dc8-9c220e0a07a4\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":100},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":160},\"y\":{\"field\":\"y\"}},\"id\":\"1bdbaf64-4ab3-4b1c-a703-2b4cdd51a219\",\"type\":\"HBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":20},\"y\":{\"field\":\"y\"}},\"id\":\"6386f34e-c85d-4473-adbe-7681bf6d7ac1\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"65269a41-7a1f-4d29-a894-471710ff8c6e\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"0f634aad-fef1-4da5-8485-b7de17593be9\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1bdbaf64-4ab3-4b1c-a703-2b4cdd51a219\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"b2a285a8-8009-42d8-84e6-570227a7c371\",\"type\":\"CDSView\"}},\"id\":\"d280d2f9-8e67-47aa-9773-90b055196e0a\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"34dc53ec-7c6a-44e2-a9bc-e76cac542ca7\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"}},\"id\":\"175772bc-b6dd-4481-bfe7-32a2f2199020\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"}},\"id\":\"b2a285a8-8009-42d8-84e6-570227a7c371\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"}},\"id\":\"51146cbe-b2db-4fbc-a213-92656eac8785\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"num_minor_ticks\":0},\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"23621143-b8f1-4317-be08-34a588f87f92\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"6386f34e-c85d-4473-adbe-7681bf6d7ac1\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"ac29c9fd-0ed1-4491-b149-32bbe6a2fc7b\",\"type\":\"CDSView\"}},\"id\":\"f6f2006d-a9a0-4f1a-a58f-1c92f0090cf3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"31b77228-0194-43b3-8285-40beaa7b39a2\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"}},\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"d581a3c9-f86b-458c-8f04-b4f10494b97f\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"8f6e5add-ac6f-424b-a305-fb18c3ee039d\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"132cea88-1051-4597-bb86-45986e2ae737\",\"type\":\"HelpTool\"},{\"attributes\":{\"source\":{\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"}},\"id\":\"ac29c9fd-0ed1-4491-b149-32bbe6a2fc7b\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.3},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"y\":{\"field\":\"y\"}},\"id\":\"0e6796bb-e53e-48aa-bd0f-594b9a3f83df\",\"type\":\"HBar\"},{\"attributes\":{\"fill_color\":{\"value\":\"black\"},\"height\":{\"value\":0.3},\"right\":{\"field\":\"right\"},\"y\":{\"field\":\"y\"}},\"id\":\"b9dc72ae-b295-4fd6-add7-d805fa6e381a\",\"type\":\"HBar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"b9dc72ae-b295-4fd6-add7-d805fa6e381a\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"0e6796bb-e53e-48aa-bd0f-594b9a3f83df\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"e241765e-3b5a-4be2-af7e-984e7aa9a21e\",\"type\":\"CDSView\"}},\"id\":\"b74dd2be-5247-49c2-8f91-74b8b95b65c3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"right\"],\"data\":{\"right\":[105,99,109,135,45],\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"}},\"id\":\"e241765e-3b5a-4be2-af7e-984e7aa9a21e\",\"type\":\"CDSView\"},{\"attributes\":{\"below\":[{\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"}],\"plot_height\":350,\"plot_width\":800,\"renderers\":[{\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"},{\"id\":\"175772bc-b6dd-4481-bfe7-32a2f2199020\",\"type\":\"Grid\"},{\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"},{\"id\":\"0a6bb0f2-941a-4f6c-a317-9b8074dc94b7\",\"type\":\"Grid\"},{\"id\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"},{\"id\":\"f6f2006d-a9a0-4f1a-a58f-1c92f0090cf3\",\"type\":\"GlyphRenderer\"},{\"id\":\"7564abb5-3afa-4be6-872a-0f7364d57e98\",\"type\":\"GlyphRenderer\"},{\"id\":\"5e38d20a-a939-46a1-91cc-988ca23d2b72\",\"type\":\"GlyphRenderer\"},{\"id\":\"d280d2f9-8e67-47aa-9773-90b055196e0a\",\"type\":\"GlyphRenderer\"},{\"id\":\"b74dd2be-5247-49c2-8f91-74b8b95b65c3\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"5f2a51c9-8834-4321-a726-ad4745c1e49a\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"f963482c-d806-412f-b20b-0704754bde06\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"3a7d2eae-34fd-4099-8058-10909276bcb3\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"37f43edc-663e-44aa-b335-1ac1452b5a4b\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"0f17fc0a-3fc1-4991-9e63-90158fc0fc26\",\"type\":\"FactorRange\"},\"y_scale\":{\"id\":\"7496bf3b-691a-403f-b62b-525c4f1a1ebf\",\"type\":\"CategoricalScale\"}},\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":null,\"text\":\"Sales Rep Performance\"},\"id\":\"5f2a51c9-8834-4321-a726-ad4745c1e49a\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"7496bf3b-691a-403f-b62b-525c4f1a1ebf\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"range_padding\":0},\"id\":\"3a7d2eae-34fd-4099-8058-10909276bcb3\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data_source\":{\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"39d7b951-2cda-4b72-9cdd-178e2788bc0a\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"11532321-cbd2-48c7-96ca-091f96ffcb79\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"5f6e25e9-323e-4cc3-b15b-be7ad4751f1c\",\"type\":\"CDSView\"}},\"id\":\"7564abb5-3afa-4be6-872a-0f7364d57e98\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"factors\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"id\":\"0f17fc0a-3fc1-4991-9e63-90158fc0fc26\",\"type\":\"FactorRange\"},{\"attributes\":{\"fill_color\":{\"value\":\"#bdc9e1\"},\"height\":{\"value\":0.8},\"left\":{\"value\":20},\"line_color\":{\"value\":\"#bdc9e1\"},\"right\":{\"value\":60},\"y\":{\"field\":\"y\"}},\"id\":\"39d7b951-2cda-4b72-9cdd-178e2788bc0a\",\"type\":\"HBar\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2f63bb8f-56d7-44dc-8dc8-9c220e0a07a4\",\"type\":\"PanTool\"},{\"id\":\"65269a41-7a1f-4d29-a894-471710ff8c6e\",\"type\":\"WheelZoomTool\"},{\"id\":\"51146cbe-b2db-4fbc-a213-92656eac8785\",\"type\":\"BoxZoomTool\"},{\"id\":\"d581a3c9-f86b-458c-8f04-b4f10494b97f\",\"type\":\"SaveTool\"},{\"id\":\"8f6e5add-ac6f-424b-a305-fb18c3ee039d\",\"type\":\"ResetTool\"},{\"id\":\"132cea88-1051-4597-bb86-45986e2ae737\",\"type\":\"HelpTool\"}]},\"id\":\"f963482c-d806-412f-b20b-0704754bde06\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"37f43edc-663e-44aa-b335-1ac1452b5a4b\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":20},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":60},\"y\":{\"field\":\"y\"}},\"id\":\"11532321-cbd2-48c7-96ca-091f96ffcb79\",\"type\":\"HBar\"}],\"root_ids\":[\"666eb784-dc29-4e39-a981-12ca3eef6744\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.15\"}};\n", " var render_items = [{\"docid\":\"6cf75f4a-ef1a-40fc-ab19-6d3c39ccc24a\",\"elementid\":\"57b1a35c-0eee-4f2a-8540-d7303201dfb4\",\"modelid\":\"666eb784-dc29-4e39-a981-12ca3eef6744\"}];\n", " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", "\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 run BokehJS code 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": "666eb784-dc29-4e39-a981-12ca3eef6744" } }, "output_type": "display_data" } ], "source": [ "show(p)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
GlyphRenderer(
id = '4abe5572-1d9d-4d00-8328-3e14208c2059', …)
data_source = ColumnDataSource(id='f0578c05-a4cf-448c-b4fc-ac09307fcb88', ...),
glyph = Segment(id='1c2c5e6e-5a1f-4244-b1f2-6a19f83c8189', ...),
hover_glyph = None,
js_event_callbacks = {},
js_property_callbacks = {},
level = 'glyph',
muted = False,
muted_glyph = None,
name = None,
nonselection_glyph = Segment(id='0b0f764c-720a-496c-b1ff-e0516ae5d22e', ...),
selection_glyph = None,
subscribed_events = [],
tags = [],
view = CDSView(id='7acc21a1-79b4-442f-ab3c-18c288dc190c', ...),
visible = True,
x_range_name = 'default',
y_range_name = 'default')
\n", "\n" ], "text/plain": [ "GlyphRenderer(id='4abe5572-1d9d-4d00-8328-3e14208c2059', ...)" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Add the segment for the target\n", "comp = [x[2]for x in data]\n", "p.segment(x0=comp, y0=[(x, -0.5) for x in cats], x1=comp, \n", " y1=[(x, 0.5) for x in cats], color=\"white\", line_width=2)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "(function(root) {\n", " function embed_document(root) {\n", " \n", " var docs_json = {\"be3c57be-147e-4c1e-8caf-74fd8437b81a\":{\"roots\":{\"references\":[{\"attributes\":{\"source\":{\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"}},\"id\":\"5f6e25e9-323e-4cc3-b15b-be7ad4751f1c\",\"type\":\"CDSView\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"}},\"id\":\"0a6bb0f2-941a-4f6c-a317-9b8074dc94b7\",\"type\":\"Grid\"},{\"attributes\":{\"fill_color\":{\"value\":\"#74a9cf\"},\"height\":{\"value\":0.8},\"left\":{\"value\":60},\"line_color\":{\"value\":\"#74a9cf\"},\"right\":{\"value\":100},\"y\":{\"field\":\"y\"}},\"id\":\"d2f85c2d-a268-46c7-ab0a-a24ffad15610\",\"type\":\"HBar\"},{\"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\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":60},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":100},\"y\":{\"field\":\"y\"}},\"id\":\"5de1f8c1-e63f-4e47-87eb-68dea6376b37\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"34dc53ec-7c6a-44e2-a9bc-e76cac542ca7\",\"type\":\"CategoricalTickFormatter\"},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"}},\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"d2f85c2d-a268-46c7-ab0a-a24ffad15610\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"5de1f8c1-e63f-4e47-87eb-68dea6376b37\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"774a4509-797b-42f5-bf06-470954774c7c\",\"type\":\"CDSView\"}},\"id\":\"5e38d20a-a939-46a1-91cc-988ca23d2b72\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"31b77228-0194-43b3-8285-40beaa7b39a2\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_color\":{\"value\":\"#f1eef6\"},\"height\":{\"value\":0.8},\"line_color\":{\"value\":\"#f1eef6\"},\"right\":{\"value\":20},\"y\":{\"field\":\"y\"}},\"id\":\"23621143-b8f1-4317-be08-34a588f87f92\",\"type\":\"HBar\"},{\"attributes\":{\"source\":{\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"}},\"id\":\"774a4509-797b-42f5-bf06-470954774c7c\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_color\":{\"value\":\"#0570b0\"},\"height\":{\"value\":0.8},\"left\":{\"value\":100},\"line_color\":{\"value\":\"#0570b0\"},\"right\":{\"value\":160},\"y\":{\"field\":\"y\"}},\"id\":\"0f634aad-fef1-4da5-8485-b7de17593be9\",\"type\":\"HBar\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":2},\"x0\":{\"field\":\"x0\"},\"x1\":{\"field\":\"x1\"},\"y0\":{\"field\":\"y0\"},\"y1\":{\"field\":\"y1\"}},\"id\":\"0b0f764c-720a-496c-b1ff-e0516ae5d22e\",\"type\":\"Segment\"},{\"attributes\":{},\"id\":\"2f63bb8f-56d7-44dc-8dc8-9c220e0a07a4\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":100},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":160},\"y\":{\"field\":\"y\"}},\"id\":\"1bdbaf64-4ab3-4b1c-a703-2b4cdd51a219\",\"type\":\"HBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":20},\"y\":{\"field\":\"y\"}},\"id\":\"6386f34e-c85d-4473-adbe-7681bf6d7ac1\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"65269a41-7a1f-4d29-a894-471710ff8c6e\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"0f634aad-fef1-4da5-8485-b7de17593be9\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1bdbaf64-4ab3-4b1c-a703-2b4cdd51a219\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"b2a285a8-8009-42d8-84e6-570227a7c371\",\"type\":\"CDSView\"}},\"id\":\"d280d2f9-8e67-47aa-9773-90b055196e0a\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"34dc53ec-7c6a-44e2-a9bc-e76cac542ca7\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"}},\"id\":\"175772bc-b6dd-4481-bfe7-32a2f2199020\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"}},\"id\":\"b2a285a8-8009-42d8-84e6-570227a7c371\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"f0578c05-a4cf-448c-b4fc-ac09307fcb88\",\"type\":\"ColumnDataSource\"}},\"id\":\"7acc21a1-79b4-442f-ab3c-18c288dc190c\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"}},\"id\":\"51146cbe-b2db-4fbc-a213-92656eac8785\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"f0578c05-a4cf-448c-b4fc-ac09307fcb88\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1c2c5e6e-5a1f-4244-b1f2-6a19f83c8189\",\"type\":\"Segment\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"0b0f764c-720a-496c-b1ff-e0516ae5d22e\",\"type\":\"Segment\"},\"selection_glyph\":null,\"view\":{\"id\":\"7acc21a1-79b4-442f-ab3c-18c288dc190c\",\"type\":\"CDSView\"}},\"id\":\"4abe5572-1d9d-4d00-8328-3e14208c2059\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"num_minor_ticks\":0},\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"23621143-b8f1-4317-be08-34a588f87f92\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"6386f34e-c85d-4473-adbe-7681bf6d7ac1\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"ac29c9fd-0ed1-4491-b149-32bbe6a2fc7b\",\"type\":\"CDSView\"}},\"id\":\"f6f2006d-a9a0-4f1a-a58f-1c92f0090cf3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"31b77228-0194-43b3-8285-40beaa7b39a2\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"}},\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"d581a3c9-f86b-458c-8f04-b4f10494b97f\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"8f6e5add-ac6f-424b-a305-fb18c3ee039d\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"132cea88-1051-4597-bb86-45986e2ae737\",\"type\":\"HelpTool\"},{\"attributes\":{\"source\":{\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"}},\"id\":\"ac29c9fd-0ed1-4491-b149-32bbe6a2fc7b\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.3},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"y\":{\"field\":\"y\"}},\"id\":\"0e6796bb-e53e-48aa-bd0f-594b9a3f83df\",\"type\":\"HBar\"},{\"attributes\":{\"fill_color\":{\"value\":\"black\"},\"height\":{\"value\":0.3},\"right\":{\"field\":\"right\"},\"y\":{\"field\":\"y\"}},\"id\":\"b9dc72ae-b295-4fd6-add7-d805fa6e381a\",\"type\":\"HBar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x0\",\"y0\",\"x1\",\"y1\"],\"data\":{\"x0\":[120,110,125,123,105],\"x1\":[120,110,125,123,105],\"y0\":[[\"John Smith\",-0.5],[\"Jane Jones\",-0.5],[\"Fred Flintstone\",-0.5],[\"Barney Rubble\",-0.5],[\"Mr T\",-0.5]],\"y1\":[[\"John Smith\",0.5],[\"Jane Jones\",0.5],[\"Fred Flintstone\",0.5],[\"Barney Rubble\",0.5],[\"Mr T\",0.5]]},\"selected\":null,\"selection_policy\":null},\"id\":\"f0578c05-a4cf-448c-b4fc-ac09307fcb88\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"b9dc72ae-b295-4fd6-add7-d805fa6e381a\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"0e6796bb-e53e-48aa-bd0f-594b9a3f83df\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"e241765e-3b5a-4be2-af7e-984e7aa9a21e\",\"type\":\"CDSView\"}},\"id\":\"b74dd2be-5247-49c2-8f91-74b8b95b65c3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"right\"],\"data\":{\"right\":[105,99,109,135,45],\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"}},\"id\":\"e241765e-3b5a-4be2-af7e-984e7aa9a21e\",\"type\":\"CDSView\"},{\"attributes\":{\"line_color\":{\"value\":\"white\"},\"line_width\":{\"value\":2},\"x0\":{\"field\":\"x0\"},\"x1\":{\"field\":\"x1\"},\"y0\":{\"field\":\"y0\"},\"y1\":{\"field\":\"y1\"}},\"id\":\"1c2c5e6e-5a1f-4244-b1f2-6a19f83c8189\",\"type\":\"Segment\"},{\"attributes\":{\"below\":[{\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"}],\"plot_height\":350,\"plot_width\":800,\"renderers\":[{\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"},{\"id\":\"175772bc-b6dd-4481-bfe7-32a2f2199020\",\"type\":\"Grid\"},{\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"},{\"id\":\"0a6bb0f2-941a-4f6c-a317-9b8074dc94b7\",\"type\":\"Grid\"},{\"id\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"},{\"id\":\"f6f2006d-a9a0-4f1a-a58f-1c92f0090cf3\",\"type\":\"GlyphRenderer\"},{\"id\":\"7564abb5-3afa-4be6-872a-0f7364d57e98\",\"type\":\"GlyphRenderer\"},{\"id\":\"5e38d20a-a939-46a1-91cc-988ca23d2b72\",\"type\":\"GlyphRenderer\"},{\"id\":\"d280d2f9-8e67-47aa-9773-90b055196e0a\",\"type\":\"GlyphRenderer\"},{\"id\":\"b74dd2be-5247-49c2-8f91-74b8b95b65c3\",\"type\":\"GlyphRenderer\"},{\"id\":\"4abe5572-1d9d-4d00-8328-3e14208c2059\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"5f2a51c9-8834-4321-a726-ad4745c1e49a\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"f963482c-d806-412f-b20b-0704754bde06\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"3a7d2eae-34fd-4099-8058-10909276bcb3\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"37f43edc-663e-44aa-b335-1ac1452b5a4b\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"0f17fc0a-3fc1-4991-9e63-90158fc0fc26\",\"type\":\"FactorRange\"},\"y_scale\":{\"id\":\"7496bf3b-691a-403f-b62b-525c4f1a1ebf\",\"type\":\"CategoricalScale\"}},\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":null,\"text\":\"Sales Rep Performance\"},\"id\":\"5f2a51c9-8834-4321-a726-ad4745c1e49a\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"7496bf3b-691a-403f-b62b-525c4f1a1ebf\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"range_padding\":0},\"id\":\"3a7d2eae-34fd-4099-8058-10909276bcb3\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data_source\":{\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"39d7b951-2cda-4b72-9cdd-178e2788bc0a\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"11532321-cbd2-48c7-96ca-091f96ffcb79\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"5f6e25e9-323e-4cc3-b15b-be7ad4751f1c\",\"type\":\"CDSView\"}},\"id\":\"7564abb5-3afa-4be6-872a-0f7364d57e98\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"factors\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"id\":\"0f17fc0a-3fc1-4991-9e63-90158fc0fc26\",\"type\":\"FactorRange\"},{\"attributes\":{\"fill_color\":{\"value\":\"#bdc9e1\"},\"height\":{\"value\":0.8},\"left\":{\"value\":20},\"line_color\":{\"value\":\"#bdc9e1\"},\"right\":{\"value\":60},\"y\":{\"field\":\"y\"}},\"id\":\"39d7b951-2cda-4b72-9cdd-178e2788bc0a\",\"type\":\"HBar\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2f63bb8f-56d7-44dc-8dc8-9c220e0a07a4\",\"type\":\"PanTool\"},{\"id\":\"65269a41-7a1f-4d29-a894-471710ff8c6e\",\"type\":\"WheelZoomTool\"},{\"id\":\"51146cbe-b2db-4fbc-a213-92656eac8785\",\"type\":\"BoxZoomTool\"},{\"id\":\"d581a3c9-f86b-458c-8f04-b4f10494b97f\",\"type\":\"SaveTool\"},{\"id\":\"8f6e5add-ac6f-424b-a305-fb18c3ee039d\",\"type\":\"ResetTool\"},{\"id\":\"132cea88-1051-4597-bb86-45986e2ae737\",\"type\":\"HelpTool\"}]},\"id\":\"f963482c-d806-412f-b20b-0704754bde06\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"37f43edc-663e-44aa-b335-1ac1452b5a4b\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":20},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":60},\"y\":{\"field\":\"y\"}},\"id\":\"11532321-cbd2-48c7-96ca-091f96ffcb79\",\"type\":\"HBar\"}],\"root_ids\":[\"666eb784-dc29-4e39-a981-12ca3eef6744\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.15\"}};\n", " var render_items = [{\"docid\":\"be3c57be-147e-4c1e-8caf-74fd8437b81a\",\"elementid\":\"d65f8087-94c4-41e2-9474-7eaa90792ed3\",\"modelid\":\"666eb784-dc29-4e39-a981-12ca3eef6744\"}];\n", " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", "\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 run BokehJS code 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": "666eb784-dc29-4e39-a981-12ca3eef6744" } }, "output_type": "display_data" } ], "source": [ "show(p)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "# Add the labels\n", "for start, label in zip(limits[:-1], labels):\n", " p.add_layout(Label(x=start, y=0, text=label, text_font_size=\"10pt\",\n", " text_color='black', y_offset=5, x_offset=15))" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "(function(root) {\n", " function embed_document(root) {\n", " \n", " var docs_json = {\"01e55d53-31ed-4125-96fa-2fe7cb4cb214\":{\"roots\":{\"references\":[{\"attributes\":{\"source\":{\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"}},\"id\":\"5f6e25e9-323e-4cc3-b15b-be7ad4751f1c\",\"type\":\"CDSView\"},{\"attributes\":{\"dimension\":1,\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"}},\"id\":\"0a6bb0f2-941a-4f6c-a317-9b8074dc94b7\",\"type\":\"Grid\"},{\"attributes\":{\"fill_color\":{\"value\":\"#74a9cf\"},\"height\":{\"value\":0.8},\"left\":{\"value\":60},\"line_color\":{\"value\":\"#74a9cf\"},\"right\":{\"value\":100},\"y\":{\"field\":\"y\"}},\"id\":\"d2f85c2d-a268-46c7-ab0a-a24ffad15610\",\"type\":\"HBar\"},{\"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\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":60},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":100},\"y\":{\"field\":\"y\"}},\"id\":\"5de1f8c1-e63f-4e47-87eb-68dea6376b37\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"34dc53ec-7c6a-44e2-a9bc-e76cac542ca7\",\"type\":\"CategoricalTickFormatter\"},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"38fb03e2-09e1-4de1-aeaa-2ff363e19f0c\",\"type\":\"CategoricalTicker\"}},\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"d2f85c2d-a268-46c7-ab0a-a24ffad15610\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"5de1f8c1-e63f-4e47-87eb-68dea6376b37\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"774a4509-797b-42f5-bf06-470954774c7c\",\"type\":\"CDSView\"}},\"id\":\"5e38d20a-a939-46a1-91cc-988ca23d2b72\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"31b77228-0194-43b3-8285-40beaa7b39a2\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_color\":{\"value\":\"#f1eef6\"},\"height\":{\"value\":0.8},\"line_color\":{\"value\":\"#f1eef6\"},\"right\":{\"value\":20},\"y\":{\"field\":\"y\"}},\"id\":\"23621143-b8f1-4317-be08-34a588f87f92\",\"type\":\"HBar\"},{\"attributes\":{\"source\":{\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"}},\"id\":\"774a4509-797b-42f5-bf06-470954774c7c\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_color\":{\"value\":\"#0570b0\"},\"height\":{\"value\":0.8},\"left\":{\"value\":100},\"line_color\":{\"value\":\"#0570b0\"},\"right\":{\"value\":160},\"y\":{\"field\":\"y\"}},\"id\":\"0f634aad-fef1-4da5-8485-b7de17593be9\",\"type\":\"HBar\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"line_width\":{\"value\":2},\"x0\":{\"field\":\"x0\"},\"x1\":{\"field\":\"x1\"},\"y0\":{\"field\":\"y0\"},\"y1\":{\"field\":\"y1\"}},\"id\":\"0b0f764c-720a-496c-b1ff-e0516ae5d22e\",\"type\":\"Segment\"},{\"attributes\":{},\"id\":\"2f63bb8f-56d7-44dc-8dc8-9c220e0a07a4\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":100},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":160},\"y\":{\"field\":\"y\"}},\"id\":\"1bdbaf64-4ab3-4b1c-a703-2b4cdd51a219\",\"type\":\"HBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":20},\"y\":{\"field\":\"y\"}},\"id\":\"6386f34e-c85d-4473-adbe-7681bf6d7ac1\",\"type\":\"HBar\"},{\"attributes\":{},\"id\":\"65269a41-7a1f-4d29-a894-471710ff8c6e\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"0f634aad-fef1-4da5-8485-b7de17593be9\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1bdbaf64-4ab3-4b1c-a703-2b4cdd51a219\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"b2a285a8-8009-42d8-84e6-570227a7c371\",\"type\":\"CDSView\"}},\"id\":\"d280d2f9-8e67-47aa-9773-90b055196e0a\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"34dc53ec-7c6a-44e2-a9bc-e76cac542ca7\",\"type\":\"CategoricalTickFormatter\"},{\"attributes\":{\"grid_line_color\":{\"value\":null},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"}},\"id\":\"175772bc-b6dd-4481-bfe7-32a2f2199020\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"}},\"id\":\"b2a285a8-8009-42d8-84e6-570227a7c371\",\"type\":\"CDSView\"},{\"attributes\":{\"source\":{\"id\":\"f0578c05-a4cf-448c-b4fc-ac09307fcb88\",\"type\":\"ColumnDataSource\"}},\"id\":\"7acc21a1-79b4-442f-ab3c-18c288dc190c\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"}},\"id\":\"51146cbe-b2db-4fbc-a213-92656eac8785\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"f0578c05-a4cf-448c-b4fc-ac09307fcb88\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1c2c5e6e-5a1f-4244-b1f2-6a19f83c8189\",\"type\":\"Segment\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"0b0f764c-720a-496c-b1ff-e0516ae5d22e\",\"type\":\"Segment\"},\"selection_glyph\":null,\"view\":{\"id\":\"7acc21a1-79b4-442f-ab3c-18c288dc190c\",\"type\":\"CDSView\"}},\"id\":\"4abe5572-1d9d-4d00-8328-3e14208c2059\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"text\":\"Poor\",\"text_color\":{\"value\":\"black\"},\"text_font_size\":{\"value\":\"10pt\"},\"x\":0,\"x_offset\":15,\"y\":0,\"y_offset\":5},\"id\":\"35df9ef3-11ec-4437-9745-902f323bf735\",\"type\":\"Label\"},{\"attributes\":{\"num_minor_ticks\":0},\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"23621143-b8f1-4317-be08-34a588f87f92\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"6386f34e-c85d-4473-adbe-7681bf6d7ac1\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"ac29c9fd-0ed1-4491-b149-32bbe6a2fc7b\",\"type\":\"CDSView\"}},\"id\":\"f6f2006d-a9a0-4f1a-a58f-1c92f0090cf3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"31b77228-0194-43b3-8285-40beaa7b39a2\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"4a08e872-b70b-4607-85d2-f51bb83f1173\",\"type\":\"BasicTicker\"}},\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"text\":\"Good\",\"text_color\":{\"value\":\"black\"},\"text_font_size\":{\"value\":\"10pt\"},\"x\":60,\"x_offset\":15,\"y\":0,\"y_offset\":5},\"id\":\"02d5c8b5-b9a2-43e2-9080-6fe07a406f37\",\"type\":\"Label\"},{\"attributes\":{},\"id\":\"d581a3c9-f86b-458c-8f04-b4f10494b97f\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"8f6e5add-ac6f-424b-a305-fb18c3ee039d\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"132cea88-1051-4597-bb86-45986e2ae737\",\"type\":\"HelpTool\"},{\"attributes\":{\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"text\":\"Excellent\",\"text_color\":{\"value\":\"black\"},\"text_font_size\":{\"value\":\"10pt\"},\"x\":100,\"x_offset\":15,\"y\":0,\"y_offset\":5},\"id\":\"827b8c17-e5c2-48df-b365-ca19e21b64b9\",\"type\":\"Label\"},{\"attributes\":{\"source\":{\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"}},\"id\":\"ac29c9fd-0ed1-4491-b149-32bbe6a2fc7b\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.3},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"field\":\"right\"},\"y\":{\"field\":\"y\"}},\"id\":\"0e6796bb-e53e-48aa-bd0f-594b9a3f83df\",\"type\":\"HBar\"},{\"attributes\":{\"fill_color\":{\"value\":\"black\"},\"height\":{\"value\":0.3},\"right\":{\"field\":\"right\"},\"y\":{\"field\":\"y\"}},\"id\":\"b9dc72ae-b295-4fd6-add7-d805fa6e381a\",\"type\":\"HBar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x0\",\"y0\",\"x1\",\"y1\"],\"data\":{\"x0\":[120,110,125,123,105],\"x1\":[120,110,125,123,105],\"y0\":[[\"John Smith\",-0.5],[\"Jane Jones\",-0.5],[\"Fred Flintstone\",-0.5],[\"Barney Rubble\",-0.5],[\"Mr T\",-0.5]],\"y1\":[[\"John Smith\",0.5],[\"Jane Jones\",0.5],[\"Fred Flintstone\",0.5],[\"Barney Rubble\",0.5],[\"Mr T\",0.5]]},\"selected\":null,\"selection_policy\":null},\"id\":\"f0578c05-a4cf-448c-b4fc-ac09307fcb88\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"9b2ac10d-64d9-458c-b2b9-d1bae3be6fd3\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"data_source\":{\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"b9dc72ae-b295-4fd6-add7-d805fa6e381a\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"0e6796bb-e53e-48aa-bd0f-594b9a3f83df\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"e241765e-3b5a-4be2-af7e-984e7aa9a21e\",\"type\":\"CDSView\"}},\"id\":\"b74dd2be-5247-49c2-8f91-74b8b95b65c3\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"text\":\"OK\",\"text_color\":{\"value\":\"black\"},\"text_font_size\":{\"value\":\"10pt\"},\"x\":20,\"x_offset\":15,\"y\":0,\"y_offset\":5},\"id\":\"ee7485a1-3148-4f8f-ba9e-76d9cd5aec1d\",\"type\":\"Label\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"right\"],\"data\":{\"right\":[105,99,109,135,45],\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"16e81a84-0e42-40bc-b65c-052d37b77e4a\",\"type\":\"ColumnDataSource\"}},\"id\":\"e241765e-3b5a-4be2-af7e-984e7aa9a21e\",\"type\":\"CDSView\"},{\"attributes\":{\"line_color\":{\"value\":\"white\"},\"line_width\":{\"value\":2},\"x0\":{\"field\":\"x0\"},\"x1\":{\"field\":\"x1\"},\"y0\":{\"field\":\"y0\"},\"y1\":{\"field\":\"y1\"}},\"id\":\"1c2c5e6e-5a1f-4244-b1f2-6a19f83c8189\",\"type\":\"Segment\"},{\"attributes\":{\"below\":[{\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"}],\"plot_height\":350,\"plot_width\":800,\"renderers\":[{\"id\":\"21e0f589-705b-4389-8a5d-744e09433947\",\"type\":\"LinearAxis\"},{\"id\":\"175772bc-b6dd-4481-bfe7-32a2f2199020\",\"type\":\"Grid\"},{\"id\":\"60bda504-82f1-4747-9793-1a2d95f45379\",\"type\":\"CategoricalAxis\"},{\"id\":\"0a6bb0f2-941a-4f6c-a317-9b8074dc94b7\",\"type\":\"Grid\"},{\"id\":\"5a9230be-c080-4fd7-a2a0-8974ecb266ef\",\"type\":\"BoxAnnotation\"},{\"id\":\"f6f2006d-a9a0-4f1a-a58f-1c92f0090cf3\",\"type\":\"GlyphRenderer\"},{\"id\":\"7564abb5-3afa-4be6-872a-0f7364d57e98\",\"type\":\"GlyphRenderer\"},{\"id\":\"5e38d20a-a939-46a1-91cc-988ca23d2b72\",\"type\":\"GlyphRenderer\"},{\"id\":\"d280d2f9-8e67-47aa-9773-90b055196e0a\",\"type\":\"GlyphRenderer\"},{\"id\":\"b74dd2be-5247-49c2-8f91-74b8b95b65c3\",\"type\":\"GlyphRenderer\"},{\"id\":\"4abe5572-1d9d-4d00-8328-3e14208c2059\",\"type\":\"GlyphRenderer\"},{\"id\":\"35df9ef3-11ec-4437-9745-902f323bf735\",\"type\":\"Label\"},{\"id\":\"ee7485a1-3148-4f8f-ba9e-76d9cd5aec1d\",\"type\":\"Label\"},{\"id\":\"02d5c8b5-b9a2-43e2-9080-6fe07a406f37\",\"type\":\"Label\"},{\"id\":\"827b8c17-e5c2-48df-b365-ca19e21b64b9\",\"type\":\"Label\"}],\"title\":{\"id\":\"5f2a51c9-8834-4321-a726-ad4745c1e49a\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"f963482c-d806-412f-b20b-0704754bde06\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"3a7d2eae-34fd-4099-8058-10909276bcb3\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"37f43edc-663e-44aa-b335-1ac1452b5a4b\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"0f17fc0a-3fc1-4991-9e63-90158fc0fc26\",\"type\":\"FactorRange\"},\"y_scale\":{\"id\":\"7496bf3b-691a-403f-b62b-525c4f1a1ebf\",\"type\":\"CategoricalScale\"}},\"id\":\"666eb784-dc29-4e39-a981-12ca3eef6744\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":null,\"text\":\"Sales Rep Performance\"},\"id\":\"5f2a51c9-8834-4321-a726-ad4745c1e49a\",\"type\":\"Title\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"7496bf3b-691a-403f-b62b-525c4f1a1ebf\",\"type\":\"CategoricalScale\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"49c7823b-7d4b-4888-a7fe-5ec2d85ab8c1\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null,\"range_padding\":0},\"id\":\"3a7d2eae-34fd-4099-8058-10909276bcb3\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data_source\":{\"id\":\"dadc36f7-7d9e-47fa-bcfc-7995cca6df47\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"39d7b951-2cda-4b72-9cdd-178e2788bc0a\",\"type\":\"HBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"11532321-cbd2-48c7-96ca-091f96ffcb79\",\"type\":\"HBar\"},\"selection_glyph\":null,\"view\":{\"id\":\"5f6e25e9-323e-4cc3-b15b-be7ad4751f1c\",\"type\":\"CDSView\"}},\"id\":\"7564abb5-3afa-4be6-872a-0f7364d57e98\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"factors\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"id\":\"0f17fc0a-3fc1-4991-9e63-90158fc0fc26\",\"type\":\"FactorRange\"},{\"attributes\":{\"fill_color\":{\"value\":\"#bdc9e1\"},\"height\":{\"value\":0.8},\"left\":{\"value\":20},\"line_color\":{\"value\":\"#bdc9e1\"},\"right\":{\"value\":60},\"y\":{\"field\":\"y\"}},\"id\":\"39d7b951-2cda-4b72-9cdd-178e2788bc0a\",\"type\":\"HBar\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2f63bb8f-56d7-44dc-8dc8-9c220e0a07a4\",\"type\":\"PanTool\"},{\"id\":\"65269a41-7a1f-4d29-a894-471710ff8c6e\",\"type\":\"WheelZoomTool\"},{\"id\":\"51146cbe-b2db-4fbc-a213-92656eac8785\",\"type\":\"BoxZoomTool\"},{\"id\":\"d581a3c9-f86b-458c-8f04-b4f10494b97f\",\"type\":\"SaveTool\"},{\"id\":\"8f6e5add-ac6f-424b-a305-fb18c3ee039d\",\"type\":\"ResetTool\"},{\"id\":\"132cea88-1051-4597-bb86-45986e2ae737\",\"type\":\"HelpTool\"}]},\"id\":\"f963482c-d806-412f-b20b-0704754bde06\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"y\"],\"data\":{\"y\":[\"John Smith\",\"Jane Jones\",\"Fred Flintstone\",\"Barney Rubble\",\"Mr T\"]},\"selected\":null,\"selection_policy\":null},\"id\":\"394d3c29-236a-436e-8f21-ec7795c8a38e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"37f43edc-663e-44aa-b335-1ac1452b5a4b\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"height\":{\"value\":0.8},\"left\":{\"value\":20},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"right\":{\"value\":60},\"y\":{\"field\":\"y\"}},\"id\":\"11532321-cbd2-48c7-96ca-091f96ffcb79\",\"type\":\"HBar\"}],\"root_ids\":[\"666eb784-dc29-4e39-a981-12ca3eef6744\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.15\"}};\n", " var render_items = [{\"docid\":\"01e55d53-31ed-4125-96fa-2fe7cb4cb214\",\"elementid\":\"bc94e9ae-50f9-4303-b974-4b8d7d446e89\",\"modelid\":\"666eb784-dc29-4e39-a981-12ca3eef6744\"}];\n", " root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n", "\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 run BokehJS code 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": "666eb784-dc29-4e39-a981-12ca3eef6744" } }, "output_type": "display_data" } ], "source": [ "show(p)" ] } ], "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.5" } }, "nbformat": 4, "nbformat_minor": 2 }