{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exercise 3.5: Automating scatter plots\n", "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You may notice that we often have to retype things like,\n", "\n", "```python\n", "p = bokeh.plotting.figure(\n", " frame_width=300,\n", " frame_height=250,\n", " x_axis_label='x',\n", " y_axis_label='y',\n", ")\n", "```\n", "\n", "and the like when making plots. You may have a certain kind of plot you often make in your work, so you might want make functions to quickly generate the kinds of plots you want. Scatter plots come up very often. Write a function that takes as input a tidy data frame and generates a scatter plot based on two columns of the data frame and colors the glyphs according to a third column that contains categorical variables. The minimal (you can add other kwargs if you want) call signature should be\n", "\n", "```python\n", "scatter(data, x, y, cat)\n", "```\n", "\n", "You will of course test out your function while writing it, and the next exercises give you lots of opportunities to use it." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Solution\n", "\n", "
" ] }, { "cell_type": "code", "execution_count": 1, "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", " const 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", " const JS_MIME_TYPE = 'application/javascript';\n", " const HTML_MIME_TYPE = 'text/html';\n", " const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n", " const CLASS_NAME = 'output_bokeh rendered_html';\n", "\n", " /**\n", " * Render data to the DOM node\n", " */\n", " function render(props, node) {\n", " const 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", " const cell = handle.cell;\n", "\n", " const id = cell.output_area._bokeh_element_id;\n", " const server_id = cell.output_area._bokeh_server_id;\n", " // Clean up Bokeh references\n", " if (id != null && id in Bokeh.index) {\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", " const cmd_clean = \"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_clean, {\n", " iopub: {\n", " output: function(msg) {\n", " const id = msg.content.text.trim();\n", " if (id in Bokeh.index) {\n", " Bokeh.index[id].model.document.clear();\n", " delete Bokeh.index[id];\n", " }\n", " }\n", " }\n", " });\n", " // Destroy server and session\n", " const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n", " cell.notebook.kernel.execute(cmd_destroy);\n", " }\n", " }\n", "\n", " /**\n", " * Handle when a new output is added\n", " */\n", " function handleAddOutput(event, handle) {\n", " const output_area = handle.output_area;\n", " const output = handle.output;\n", "\n", " // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n", " if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n", " return\n", " }\n", "\n", " const 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", " const bk_div = document.createElement(\"div\");\n", " bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n", " const script_attrs = bk_div.children[0].attributes;\n", " for (let i = 0; i < script_attrs.length; i++) {\n", " toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n", " toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\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", " const 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", " const 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", " const events = require('base/js/events');\n", " const 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", " const 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", " const el = document.getElementById(\"1002\");\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) {\n", " if (callback != null)\n", " callback();\n", " });\n", " } finally {\n", " delete root._bokeh_onload_callbacks\n", " }\n", " console.debug(\"Bokeh: all callbacks have finished\");\n", " }\n", "\n", " function load_libs(css_urls, js_urls, callback) {\n", " if (css_urls == null) css_urls = [];\n", " if (js_urls == null) js_urls = [];\n", "\n", " root._bokeh_onload_callbacks.push(callback);\n", " if (root._bokeh_is_loading > 0) {\n", " console.debug(\"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.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", " root._bokeh_is_loading = css_urls.length + js_urls.length;\n", "\n", " function on_load() {\n", " root._bokeh_is_loading--;\n", " if (root._bokeh_is_loading === 0) {\n", " console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n", " run_callbacks()\n", " }\n", " }\n", "\n", " function on_error(url) {\n", " console.error(\"failed to load \" + url);\n", " }\n", "\n", " for (let i = 0; i < css_urls.length; i++) {\n", " const url = css_urls[i];\n", " const element = document.createElement(\"link\");\n", " element.onload = on_load;\n", " element.onerror = on_error.bind(null, url);\n", " element.rel = \"stylesheet\";\n", " element.type = \"text/css\";\n", " element.href = url;\n", " console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n", " document.body.appendChild(element);\n", " }\n", "\n", " for (let i = 0; i < js_urls.length; i++) {\n", " const url = js_urls[i];\n", " const element = document.createElement('script');\n", " element.onload = on_load;\n", " element.onerror = on_error.bind(null, url);\n", " element.async = false;\n", " element.src = url;\n", " console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", " document.head.appendChild(element);\n", " }\n", " };\n", "\n", " function inject_raw_css(css) {\n", " const element = document.createElement(\"style\");\n", " element.appendChild(document.createTextNode(css));\n", " document.body.appendChild(element);\n", " }\n", "\n", " \n", " const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.2.min.js\"];\n", " const css_urls = [];\n", " \n", "\n", " const inline_js = [\n", " function(Bokeh) {\n", " Bokeh.set_log_level(\"info\");\n", " },\n", " function(Bokeh) {\n", " \n", " \n", " }\n", " ];\n", "\n", " function run_inline_js() {\n", " \n", " if (root.Bokeh !== undefined || force === true) {\n", " \n", " for (let i = 0; i < inline_js.length; i++) {\n", " inline_js[i].call(root, root.Bokeh);\n", " }\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", " const cell = $(document.getElementById(\"1002\")).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.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n", " run_inline_js();\n", " } else {\n", " load_libs(css_urls, js_urls, function() {\n", " console.debug(\"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 const 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 const 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 const el = document.getElementById(\"1002\");\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) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.debug(\"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.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n\n function on_error(url) {\n console.error(\"failed to load \" + url);\n }\n\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n }\n\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n \n const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.2.min.js\"];\n const css_urls = [];\n \n\n const inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n function(Bokeh) {\n \n \n }\n ];\n\n function run_inline_js() {\n \n if (root.Bokeh !== undefined || force === true) {\n \n for (let i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }\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 const cell = $(document.getElementById(\"1002\")).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.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(css_urls, js_urls, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import pandas as pd\n", "\n", "import colorcet\n", "\n", "import bokeh.io\n", "import bokeh.plotting\n", "\n", "bokeh.io.output_notebook()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "I will offer some more kwargs, as described in the doc string below. I will demonstrate the use of this function in the next problem." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "def scatter(\n", " data=None,\n", " x=None,\n", " y=None,\n", " cat=None,\n", " p=None,\n", " palette=None,\n", " show_legend=True,\n", " click_policy=\"hide\",\n", " marker_kwargs={},\n", " **kwargs,\n", "):\n", " \"\"\"\n", " Parameters\n", " ----------\n", " df : Pandas DataFrame\n", " DataFrame containing tidy data for plotting.\n", " x : hashable\n", " Name of column to use as x-axis.\n", " y : hashable\n", " Name of column to use as y-axis.\n", " cat : hashable\n", " Name of column to use as categorical variable.\n", " p : bokeh.plotting.Figure instance, or None (default)\n", " If None, create a new figure. Otherwise, populate the existing\n", " figure `p`.\n", " palette : list of strings of hex colors, or single hex string\n", " If a list, color palette to use. If a single string representing\n", " a hex color, all glyphs are colored with that color. Default is\n", " the Glasbey Catagory 10.\n", " show_legend : bool, default False\n", " If True, show legend.\n", " tooltips : list of 2-tuples\n", " Specification for tooltips as per Bokeh specifications. For\n", " example, if we want `col1` and `col2` tooltips, we can use\n", " `tooltips=[('label 1': '@col1'), ('label 2': '@col2')]`. Ignored\n", " if `formal` is True.\n", " show_legend : bool, default False\n", " If True, show a legend.\n", " click_policy : str, default \"hide\"\n", " How to display points when their legend entry is clicked.\n", " marker_kwargs : dict\n", " kwargs to be passed to `p.circle()` when making the scatter plot.\n", " kwargs\n", " Any kwargs to be passed to `bokeh.plotting.figure()` when making \n", " the plot.\n", "\n", " Returns\n", " -------\n", " output : bokeh.plotting.Figure instance\n", " Plot populated with jitter plot or box plot.\n", " \"\"\"\n", " # Automatically name the axes\n", " if \"x_axis_label\" not in kwargs:\n", " kwargs[\"x_axis_label\"] = x\n", " if \"y_axis_label\" not in kwargs:\n", " kwargs[\"y_axis_label\"] = y\n", "\n", " # Default palette\n", " if palette is None:\n", " palette = colorcet.b_glasbey_category10\n", " elif type(palette) == str:\n", " palette = [palette]\n", "\n", " # Instantiate figure\n", " if p is None:\n", " p = bokeh.plotting.figure(**kwargs)\n", "\n", " # Build plot (not using color factors) to enable click policies\n", " for i, (name, g) in enumerate(data.groupby(cat, sort=False)):\n", " marker_kwargs[\"color\"] = palette[i % len(palette)]\n", " marker_kwargs[\"legend_label\"] = str(name)\n", " p.circle(source=g, x=x, y=y, **marker_kwargs)\n", "\n", " if show_legend:\n", " p.legend.click_policy = click_policy\n", " else:\n", " p.legend.visible = False\n", "\n", " return p" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will test this function out on the frog tongue adhesion data, coloring by frog ID." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "
\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "(function(root) {\n", " function embed_document(root) {\n", " \n", " const docs_json = {\"52939c83-8d15-46b4-8289-c654f9b31902\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1012\"}],\"center\":[{\"id\":\"1015\"},{\"id\":\"1019\"},{\"id\":\"1052\"}],\"frame_height\":350,\"frame_width\":450,\"left\":[{\"id\":\"1016\"}],\"renderers\":[{\"id\":\"1039\"},{\"id\":\"1059\"},{\"id\":\"1080\"},{\"id\":\"1103\"}],\"title\":{\"id\":\"1041\"},\"toolbar\":{\"id\":\"1027\"},\"x_range\":{\"id\":\"1004\"},\"x_scale\":{\"id\":\"1008\"},\"y_range\":{\"id\":\"1006\"},\"y_scale\":{\"id\":\"1010\"}},\"id\":\"1003\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"fill_color\":{\"value\":\"#d62628\"},\"hatch_color\":{\"value\":\"#d62628\"},\"line_color\":{\"value\":\"#d62628\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1100\",\"type\":\"Circle\"},{\"attributes\":{\"coordinates\":null,\"group\":null},\"id\":\"1041\",\"type\":\"Title\"},{\"attributes\":{\"fill_color\":{\"value\":\"#ff7e0e\"},\"hatch_color\":{\"value\":\"#ff7e0e\"},\"line_color\":{\"value\":\"#ff7e0e\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1056\",\"type\":\"Circle\"},{\"attributes\":{\"fill_color\":{\"value\":\"#2ba02b\"},\"hatch_color\":{\"value\":\"#2ba02b\"},\"line_color\":{\"value\":\"#2ba02b\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1077\",\"type\":\"Circle\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1054\"},\"glyph\":{\"id\":\"1056\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1058\"},\"nonselection_glyph\":{\"id\":\"1057\"},\"view\":{\"id\":\"1060\"}},\"id\":\"1059\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#2ba02b\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#2ba02b\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#2ba02b\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1078\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1006\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1010\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_color\":{\"value\":\"#1f77b3\"},\"hatch_color\":{\"value\":\"#1f77b3\"},\"line_color\":{\"value\":\"#1f77b3\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1036\",\"type\":\"Circle\"},{\"attributes\":{\"overlay\":{\"id\":\"1026\"}},\"id\":\"1022\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1044\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"AllLabels\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1034\"},\"glyph\":{\"id\":\"1036\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1038\"},\"nonselection_glyph\":{\"id\":\"1037\"},\"view\":{\"id\":\"1040\"}},\"id\":\"1039\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b3\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#1f77b3\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b3\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1037\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1013\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1047\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"label\":{\"value\":\"IV\"},\"renderers\":[{\"id\":\"1103\"}]},\"id\":\"1122\",\"type\":\"LegendItem\"},{\"attributes\":{\"data\":{\"ID\":[\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\",\"IV\"],\"adhesive force (mN)\":[-456,-193,-236,-225,-217,-161,-139,-264,-342,-231,-209,-292,-339,-371,-331,-302,-216,-163,-367,-218],\"adhesive force / body weight\":{\"__ndarray__\":\"MzMzMzMzC0AK16NwPQr3Pylcj8L1KPw/4XoUrkfh+j/D9Shcj8L5PzMzMzMzM/M/pHA9Ctej8D+F61G4HoX/P2ZmZmZmZgRAhetRuB6F+z/NzMzMzMz4P1yPwvUoXAFAPQrXo3A9BEAUrkfhehQGQMP1KFyPwgNAAAAAAAAAAkDD9Shcj8L5P1yPwvUoXPM/16NwPQrXBUAUrkfhehT6Pw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"adhesive impulse (N-s)\":{\"__ndarray__\":\"mpmZmZmZqb+q8dJNYhCovxBYObTIdr6/KVyPwvUovL9aZDvfT42Xvzm0yHa+n6q/YhBYObTItr97FK5H4XrEvyGwcmiR7cy/TDeJQWDloL+HFtnO91PDvxkEVg4tss2/lkOLbOf70b+q8dJNYhC4v4PAyqFFtrO/CKwcWmQ7v7+YbhKDwMrBvy2yne+nxsu/8tJNYhBYyb8IrBxaZDu/vw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"adhesive strength (Pa)\":[-3440,-3400,-4647,-1581,-1245,-2866,-2141,-2136,-2497,-3847,-1889,-2018,-1772,-4447,-2190,-2591,-1759,-1257,-2857,-1688],\"contact area with mucus / contact area without mucus\":{\"__ndarray__\":\"KVyPwvUo7D+PwvUoXI/qP0jhehSuR+E/uB6F61G43j9cj8L1KFzvP3sUrkfhepQ/H4XrUbge7T+PwvUoXI/SP4/C9Shcj+o/uB6F61G4nj/hehSuR+HqP65H4XoUru8/AAAAAAAA8D+4HoXrUbi+P7gehetRuOY/7FG4HoXrsT8AAAAAAADwPwrXo3A9Cu8/cT0K16Nw3T+F61G4HoXjPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"contact area without mucus (mm2)\":[0,74,44,108,39,4,77,81,0,4,69,50,12,18,20,30,20,42,108,68],\"contact pressure (Pa)\":[1297,2498,735,3177,2037,397,7713,2205,5259,9705,1793,1369,3116,6184,5386,3446,4928,5498,4776,3617],\"date\":[\"2013_05_27\",\"2013_05_27\",\"2013_05_27\",\"2013_05_30\",\"2013_05_30\",\"2013_05_30\",\"2013_06_03\",\"2013_06_11\",\"2013_06_11\",\"2013_06_11\",\"2013_06_11\",\"2013_06_14\",\"2013_06_18\",\"2013_06_18\",\"2013_06_18\",\"2013_06_18\",\"2013_06_21\",\"2013_06_21\",\"2013_06_21\",\"2013_06_21\"],\"impact force (mN)\":[172,142,37,453,355,22,502,273,720,582,198,198,597,516,815,402,605,711,614,468],\"impact force / body weight\":{\"__ndarray__\":\"exSuR+F69D/NzMzMzMzwP+xRuB6F69E/9ihcj8L1CkAfhetRuB4FQMP1KFyPwsU/7FG4HoXrDUA9CtejcD0AQHE9CtejcBVAXI/C9ShcEUCF61G4HoX3P4XrUbgehfc/w/UoXI/CEUC4HoXrUbgOQEjhehSuRxhAAAAAAAAACEAAAAAAAAASQDMzMzMzMxVASOF6FK5HEkDXo3A9CtcLQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"impact time (ms)\":[26,20,55,38,31,33,74,26,27,33,23,6,29,31,34,38,39,76,33,36],\"index\":[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79],\"time frog pulls on target (ms)\":[462,250,743,844,728,472,959,844,1515,279,1427,2874,4251,626,1254,986,1627,2021,1366,1269],\"total contact area (mm2)\":[133,57,51,142,174,56,65,124,137,60,110,145,191,83,151,117,123,129,128,129],\"trial number\":[2,3,4,1,2,3,1,1,2,3,4,1,1,2,3,4,1,2,3,4]},\"selected\":{\"id\":\"1120\"},\"selection_policy\":{\"id\":\"1119\"}},\"id\":\"1098\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis\":{\"id\":\"1012\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1015\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1017\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1120\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"HelpTool\"},{\"attributes\":{\"axis\":{\"id\":\"1016\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1019\",\"type\":\"Grid\"},{\"attributes\":{\"axis_label\":\"impact force (mN)\",\"coordinates\":null,\"formatter\":{\"id\":\"1047\"},\"group\":null,\"major_label_policy\":{\"id\":\"1048\"},\"ticker\":{\"id\":\"1013\"}},\"id\":\"1012\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1008\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1020\",\"type\":\"PanTool\"},{\"attributes\":{\"data\":{\"ID\":[\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\",\"II\"],\"adhesive force (mN)\":[-655,-292,-246,-245,-553,-664,-261,-691,-92,-566,-223,-512,-227,-573,-522,-599,-364,-469,-844,-648],\"adhesive force / body weight\":{\"__ndarray__\":\"pHA9Ctej+D8UrkfhehTmP4/C9Shcj+I/j8L1KFyP4j/NzMzMzMz0P/YoXI/C9fg/hetRuB6F4z8UrkfhehT6Pylcj8L1KMw/SOF6FK5H9T+kcD0K16PgPzMzMzMzM/M/9ihcj8L14D+amZmZmZn1P65H4XoUrvM/j8L1KFyP9j+F61G4HoXrP5qZmZmZmfE/16NwPQrX/z9SuB6F61H4Pw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"adhesive impulse (N-s)\":{\"__ndarray__\":\"pHA9Ctej2L83iUFg5dDSvz81XrpJDNK/w/UoXI/C1b/ZzvdT46Xbv1pkO99Pjae/5dAi2/l+2r+TGARWDi2yv/yp8dJNYoC/Gy/dJAaBtb+Nl24Sg8DKvylcj8L1KKy/ObTIdr6fmr+F61G4HoXLv2iR7Xw/Nb6/IbByaJHtzL81XrpJDALLv6RwPQrXo9C/y6FFtvP91L9g5dAi2/m+vw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"adhesive strength (Pa)\":[-1881,-1177,-1894,-2301,-2004,-7802,-803,-2860,-678,-4506,-942,-17652,-1101,-3014,-1860,-2757,-1927,-2129,-4925,-4573],\"contact area with mucus / contact area without mucus\":{\"__ndarray__\":\"uB6F61G47j/NzMzMzMzsP65H4XoUruc/UrgehetR6D8UrkfhehTuPwrXo3A9Cuc/zczMzMzM7D8K16NwPQrnPwAAAAAAAPA/CtejcD0K7z8K16NwPQrvP7gehetRuJ4/AAAAAAAA8D9SuB6F61HoPwAAAAAAAPA/AAAAAAAA8D/2KFyPwvXgP3E9CtejcOU/UrgehetR2D9mZmZmZmbmPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"contact area without mucus (mm2)\":[15,24,34,26,16,24,33,67,0,4,8,28,0,46,0,0,89,72,106,43],\"contact pressure (Pa)\":[4633,2441,2517,8893,1959,18073,1627,2600,10645,2367,2972,9279,3647,1288,4213,2369,2302,1737,2665,5149],\"date\":[\"2013_03_19\",\"2013_03_19\",\"2013_03_19\",\"2013_03_19\",\"2013_03_21\",\"2013_03_21\",\"2013_03_21\",\"2013_03_21\",\"2013_03_25\",\"2013_03_25\",\"2013_03_25\",\"2013_03_25\",\"2013_03_28\",\"2013_03_28\",\"2013_04_03\",\"2013_04_03\",\"2013_04_08\",\"2013_04_08\",\"2013_04_08\",\"2013_04_12\"],\"impact force (mN)\":[1612,605,327,946,541,1539,529,628,1453,297,703,269,751,245,1182,515,435,383,457,730],\"impact force / body weight\":{\"__ndarray__\":\"UrgehetRDkC4HoXrUbj2P6RwPQrXo+g/16NwPQrXAUBSuB6F61H0P/YoXI/C9QxA16NwPQrX8z+uR+F6FK73P1yPwvUoXAtAZmZmZmZm5j9mZmZmZmb6Pylcj8L1KOQ/UrgehetR/D+PwvUoXI/iPz0K16NwPQZAXI/C9Shc8z9SuB6F61HwP83MzMzMzOw/SOF6FK5H8T+F61G4HoX7Pw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"impact time (ms)\":[18,55,51,59,33,43,28,31,72,42,33,57,39,21,28,29,26,31,15,42],\"index\":[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],\"time frog pulls on target (ms)\":[3087,1261,1508,1841,3126,741,2482,998,1652,936,2152,189,1195,1466,1197,1486,1017,974,780,786],\"total contact area (mm2)\":[348,248,130,106,276,85,325,242,136,126,237,29,206,190,281,217,189,221,171,142],\"trial number\":[1,2,3,4,1,2,3,4,1,2,3,4,1,2,1,2,1,2,3,1]},\"selected\":{\"id\":\"1072\"},\"selection_policy\":{\"id\":\"1071\"}},\"id\":\"1054\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1004\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data\":{\"ID\":[\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\"],\"adhesive force (mN)\":[-785,-983,-850,-455,-974,-592,-512,-804,-690,-462,-766,-715,-613,-677,-528,-452,-430,-652,-692,-536],\"adhesive force / body weight\":{\"__ndarray__\":\"UrgehetR9D9xPQrXo3D5P+xRuB6F6/U/rkfhehSu5z8fhetRuB75P7gehetRuO4/j8L1KFyP6j/NzMzMzMz0P+xRuB6F6/E/AAAAAAAA6D/Xo3A9CtfzP2ZmZmZmZvI/rkfhehSu7z9xPQrXo3DxPzMzMzMzM+s/XI/C9Shc5z9mZmZmZmbmP83MzMzMzPA/7FG4HoXr8T/Xo3A9CtfrPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"adhesive impulse (N-s)\":{\"__ndarray__\":\"j8L1KFyP0r9eukkMAivHv39qvHSTGMS/w/UoXI/Cxb/fT42XbhLbv7pJDAIrh8a/PQrXo3A90r89CtejcD3Sv2Q730+Nl86/y6FFtvP91L9SuB6F61HYv99PjZduEtO/+n5qvHST6L9zaJHtfD/dv2Q730+Nl9a//tR46SYx0L9Ei2zn+6nRv6abxCCwctC/fT81XrpJ1L+mm8QgsHLYvw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"adhesive strength (Pa)\":[-2030,-9695,-10239,-1381,-3975,-1737,-1427,-3266,-2568,-1733,-1879,-5064,-1348,-3636,-3453,-1557,-1677,-4425,-1901,-2073],\"contact area with mucus / contact area without mucus\":{\"__ndarray__\":\"PQrXo3A96j/sUbgeheuxP5qZmZmZmak/pHA9Ctej4D+4HoXrUbi+PxSuR+F6FOY/FK5H4XoU5j/sUbgehevRP8P1KFyPwsU/w/UoXI/C1T9xPQrXo3DtP+F6FK5H4co/mpmZmZmZ6T/Xo3A9CtfTP7gehetRuJ4/exSuR+F65D+kcD0K16PgPwrXo3A9Crc/7FG4HoXr0T9mZmZmZmbWPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"contact area without mucus (mm2)\":[70,94,79,158,216,106,110,178,224,176,33,112,92,129,148,105,124,134,260,168],\"contact pressure (Pa)\":[3117,24923,21020,4718,2012,6676,1550,7832,9824,7122,4638,10947,2874,9089,10095,4419,3019,13784,3406,1830],\"date\":[\"2013_02_26\",\"2013_02_26\",\"2013_03_01\",\"2013_03_01\",\"2013_03_01\",\"2013_03_01\",\"2013_03_05\",\"2013_03_05\",\"2013_03_05\",\"2013_03_05\",\"2013_03_12\",\"2013_03_12\",\"2013_03_12\",\"2013_03_12\",\"2013_03_12\",\"2013_03_15\",\"2013_03_15\",\"2013_03_15\",\"2013_03_15\",\"2013_03_15\"],\"impact force (mN)\":[1205,2527,1745,1556,493,2276,556,1928,2641,1897,1891,1545,1307,1692,1543,1282,775,2032,1240,473],\"impact force / body weight\":{\"__ndarray__\":\"MzMzMzMz/z9SuB6F61EQQI/C9ShcjwZAFK5H4XoUBECamZmZmZnpP3E9CtejcA1AzczMzMzM7D/hehSuR+EIQBSuR+F6FBFAexSuR+F6CEB7FK5H4XoIQAAAAAAAAARA4XoUrkfhAEDXo3A9CtcFQOxRuB6F6wNAj8L1KFyPAEAAAAAAAAD0Pz0K16NwPQpAAAAAAAAAAEBSuB6F61HoPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"impact time (ms)\":[46,44,34,41,36,31,43,46,50,41,40,48,29,31,38,31,34,60,34,40],\"index\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],\"time frog pulls on target (ms)\":[884,248,211,1025,499,969,835,508,491,839,1069,649,1845,917,750,785,837,486,906,1218],\"total contact area (mm2)\":[387,101,83,330,245,341,359,246,269,266,408,141,455,186,153,290,257,147,364,259],\"trial number\":[3,4,1,2,3,4,1,2,3,4,1,2,3,4,5,1,2,3,4,5]},\"selected\":{\"id\":\"1050\"},\"selection_policy\":{\"id\":\"1049\"}},\"id\":\"1034\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1095\",\"type\":\"Selection\"},{\"attributes\":{\"tools\":[{\"id\":\"1020\"},{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"}]},\"id\":\"1027\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1071\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1050\",\"type\":\"Selection\"},{\"attributes\":{\"label\":{\"value\":\"I\"},\"renderers\":[{\"id\":\"1039\"}]},\"id\":\"1053\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1119\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1049\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#d62628\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#d62628\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#d62628\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1101\",\"type\":\"Circle\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1026\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"source\":{\"id\":\"1075\"}},\"id\":\"1081\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1094\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"label\":{\"value\":\"II\"},\"renderers\":[{\"id\":\"1059\"}]},\"id\":\"1074\",\"type\":\"LegendItem\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#d62628\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#d62628\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#d62628\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1102\",\"type\":\"Circle\"},{\"attributes\":{\"label\":{\"value\":\"III\"},\"renderers\":[{\"id\":\"1080\"}]},\"id\":\"1097\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1072\",\"type\":\"Selection\"},{\"attributes\":{\"source\":{\"id\":\"1034\"}},\"id\":\"1040\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"ResetTool\"},{\"attributes\":{\"data\":{\"ID\":[\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\",\"III\"],\"adhesive force (mN)\":[-94,-163,-172,-225,-301,-93,-131,-289,-104,-229,-259,-231,-267,-178,-123,-151,-127,-372,-236,-390],\"adhesive force / body weight\":{\"__ndarray__\":\"UrgehetR6D/2KFyPwvX0PxSuR+F6FPY/9ihcj8L1/D9cj8L1KFwDQAAAAAAAAOg/zczMzMzM8D+kcD0K16MCQOF6FK5H4eo/mpmZmZmZ/T+kcD0K16MAQMP1KFyPwv0/H4XrUbgeAUDhehSuR+H2P65H4XoUru8/hetRuB6F8z9SuB6F61HwP+xRuB6F6wdAZmZmZmZm/j8fhetRuB4JQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"adhesive impulse (N-s)\":{\"__ndarray__\":\"/Knx0k1iUL/8qfHSTWKgv9NNYhBYObS/TDeJQWDlwL/Xo3A9CtfDvylcj8L1KLy/O99PjZduor/jpZvEILCyvylcj8L1KKy/8KfGSzeJwb+iRbbz/dTIvxsv3SQGgaW/BoGVQ4tsx7+cxCCwcmihvxkEVg4tsp2/y6FFtvP9tL+F61G4HoXLv+xRuB6F68G/aJHtfD81vr85tMh2vp/Kvw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"adhesive strength (Pa)\":[-967,-1507,-3149,-1818,-2354,-2181,-1005,-2555,-902,-2580,-2855,-2819,-2213,-9364,-5843,-4882,-896,-5136,-1834,-3492],\"contact area with mucus / contact area without mucus\":{\"__ndarray__\":\"j8L1KFyP6j8zMzMzMzPjP65H4XoUrtc/pHA9Ctej6D97FK5H4XqUP7gehetRuOY/AAAAAAAA8D+4HoXrUbjePx+F61G4HuU/ZmZmZmZm7j8zMzMzMzPDP3sUrkfheoQ/zczMzMzM7D+amZmZmZmpP5qZmZmZmak/uB6F61G4nj+F61G4HoXrP+F6FK5H4do/exSuR+F6xD/2KFyPwvXYPw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"contact area without mucus (mm2)\":[15,10,23,17,43,34,74,4,55,6,88,23,58,17,29,126,12,1,0,58],\"contact pressure (Pa)\":[6326,3824,5946,6272,4770,12699,4130,5110,6993,5165,5048,7633,5152,28641,25471,12409,2835,8475,5171,4376],\"date\":[\"2013_05_27\",\"2013_05_27\",\"2013_05_27\",\"2013_06_11\",\"2013_06_11\",\"2013_06_11\",\"2013_06_14\",\"2013_06_14\",\"2013_06_18\",\"2013_06_18\",\"2013_06_18\",\"2013_06_18\",\"2013_06_21\",\"2013_06_21\",\"2013_06_21\",\"2013_06_21\",\"2013_06_26\",\"2013_06_26\",\"2013_06_26\",\"2013_06_26\"],\"impact force (mN)\":[614,414,324,776,611,544,538,579,806,459,458,626,621,544,535,385,401,614,665,488],\"impact force / body weight\":{\"__ndarray__\":\"w/UoXI/CE0CkcD0K16MKQOF6FK5H4QRA9ihcj8L1GECkcD0K16MTQIXrUbgehRFASOF6FK5HEUCkcD0K16MSQPYoXI/C9RlAmpmZmZmZDUCF61G4HoUNQClcj8L1KBRA9ihcj8L1E0CF61G4HoURQDMzMzMzMxFAuB6F61G4CEDXo3A9CtcJQMP1KFyPwhNAZmZmZmZmFUBxPQrXo3APQA==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[20]},\"impact time (ms)\":[88,143,105,35,29,16,38,31,29,32,30,16,27,30,35,39,36,34,40,34],\"index\":[40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],\"time frog pulls on target (ms)\":[683,245,619,1823,918,1351,1790,1006,883,1218,910,550,2081,376,289,607,2932,680,685,1308],\"total contact area (mm2)\":[97,108,55,124,128,43,130,113,115,89,91,82,120,19,21,31,142,72,129,112],\"trial number\":[1,2,3,1,2,3,1,2,1,2,3,4,1,2,3,4,1,2,3,4]},\"selected\":{\"id\":\"1095\"},\"selection_policy\":{\"id\":\"1094\"}},\"id\":\"1075\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"click_policy\":\"hide\",\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"1053\"},{\"id\":\"1074\"},{\"id\":\"1097\"},{\"id\":\"1122\"}]},\"id\":\"1052\",\"type\":\"Legend\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#2ba02b\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#2ba02b\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#2ba02b\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1079\",\"type\":\"Circle\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#ff7e0e\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#ff7e0e\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#ff7e0e\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1057\",\"type\":\"Circle\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1098\"},\"glyph\":{\"id\":\"1100\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1102\"},\"nonselection_glyph\":{\"id\":\"1101\"},\"view\":{\"id\":\"1104\"}},\"id\":\"1103\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis_label\":\"adhesive force (mN)\",\"coordinates\":null,\"formatter\":{\"id\":\"1044\"},\"group\":null,\"major_label_policy\":{\"id\":\"1045\"},\"ticker\":{\"id\":\"1017\"}},\"id\":\"1016\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1098\"}},\"id\":\"1104\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#1f77b3\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#1f77b3\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#1f77b3\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1038\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1048\",\"type\":\"AllLabels\"},{\"attributes\":{\"source\":{\"id\":\"1054\"}},\"id\":\"1060\",\"type\":\"CDSView\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1075\"},\"glyph\":{\"id\":\"1077\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1079\"},\"nonselection_glyph\":{\"id\":\"1078\"},\"view\":{\"id\":\"1081\"}},\"id\":\"1080\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#ff7e0e\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#ff7e0e\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#ff7e0e\"},\"x\":{\"field\":\"impact force (mN)\"},\"y\":{\"field\":\"adhesive force (mN)\"}},\"id\":\"1058\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"WheelZoomTool\"}],\"root_ids\":[\"1003\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n", " const render_items = [{\"docid\":\"52939c83-8d15-46b4-8289-c654f9b31902\",\"root_ids\":[\"1003\"],\"roots\":{\"1003\":\"ef1f06de-bf20-48ed-8fc4-49fe88c0376a\"}}];\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", " let attempts = 0;\n", " const timer = setInterval(function(root) {\n", " if (root.Bokeh !== undefined) {\n", " clearInterval(timer);\n", " embed_document(root);\n", " } else {\n", " attempts++;\n", " if (attempts > 100) {\n", " clearInterval(timer);\n", " console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n", " }\n", " }\n", " }, 10, root)\n", " }\n", "})(window);" ], "application/vnd.bokehjs_exec.v0+json": "" }, "metadata": { "application/vnd.bokehjs_exec.v0+json": { "id": "1003" } }, "output_type": "display_data" } ], "source": [ "df = pd.read_csv('data/frog_tongue_adhesion.csv', comment='#')\n", "\n", "p = scatter(\n", " data=df,\n", " x='impact force (mN)',\n", " y='adhesive force (mN)',\n", " cat='ID',\n", " frame_height=350,\n", " frame_width=450\n", ")\n", "\n", "bokeh.io.show(p)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Computing environment" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "tags": [ "hide-input" ] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Python implementation: CPython\n", "Python version : 3.9.12\n", "IPython version : 8.3.0\n", "\n", "pandas : 1.4.2\n", "bokeh : 2.4.2\n", "jupyterlab: 3.3.2\n", "\n" ] } ], "source": [ "%load_ext watermark\n", "%watermark -v -p pandas,bokeh,jupyterlab" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.9.12" } }, "nbformat": 4, "nbformat_minor": 4 }