Skip to content

Instantly share code, notes, and snippets.

@rutj3
Created November 24, 2016 08:49
Show Gist options
  • Save rutj3/1f7b890eb765daefe1f3cea7dd2e9484 to your computer and use it in GitHub Desktop.
Save rutj3/1f7b890eb765daefe1f3cea7dd2e9484 to your computer and use it in GitHub Desktop.
bokeh scatter
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"e8e7d18f-76bb-4476-b6d8-e4c5d20bbef6\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = \"1\";\n",
"\n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force !== \"\") {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
"\n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force !== \"\") {\n",
" window._bokeh_timeout = Date.now() + 5000;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" Bokeh.$(\"#e8e7d18f-76bb-4476-b6d8-e4c5d20bbef6\").text(\"BokehJS successfully loaded.\");\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
"\n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
"\n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"e8e7d18f-76bb-4476-b6d8-e4c5d20bbef6\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'e8e7d18f-76bb-4476-b6d8-e4c5d20bbef6' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
"\n",
" var js_urls = ['https://cdn.pydata.org/bokeh/release/bokeh-0.12.3.min.js', 'https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.3.min.js'];\n",
"\n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.set_log_level(\"info\");\n",
" },\n",
" \n",
" function(Bokeh) {\n",
" \n",
" Bokeh.$(\"#e8e7d18f-76bb-4476-b6d8-e4c5d20bbef6\").text(\"BokehJS is loading...\");\n",
" },\n",
" function(Bokeh) {\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.3.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.3.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.3.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.3.min.css\");\n",
" }\n",
" ];\n",
"\n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === \"1\")) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === \"1\") {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (!force) {\n",
" var cell = $(\"#e8e7d18f-76bb-4476-b6d8-e4c5d20bbef6\").parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(this));"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import io\n",
"import pandas as pd\n",
"\n",
"from bokeh.plotting import figure, show, output_file, output_notebook\n",
"output_notebook()\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>idx</th>\n",
" <th>Unnamed</th>\n",
" <th>fans</th>\n",
" <th>id</th>\n",
" <th>stars</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>69</td>\n",
" <td>18kPq7GPye-YQ3LyKyAZPw</td>\n",
" <td>4.14</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1345</td>\n",
" <td>rpOyqD_893cqmDAtJLbdog</td>\n",
" <td>3.67</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>105</td>\n",
" <td>4U9kSBLuBDU391x6bxU-YA</td>\n",
" <td>3.68</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" <td>2</td>\n",
" <td>fHtTaujcyKvXglE33Z5yIw</td>\n",
" <td>4.64</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>SIBCL7HBkrP4llolm4SC2A</td>\n",
" <td>3.80</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" idx Unnamed fans id stars\n",
"0 0 0 69 18kPq7GPye-YQ3LyKyAZPw 4.14\n",
"1 1 1 1345 rpOyqD_893cqmDAtJLbdog 3.67\n",
"2 2 2 105 4U9kSBLuBDU391x6bxU-YA 3.68\n",
"3 3 3 2 fHtTaujcyKvXglE33Z5yIw 4.64\n",
"4 4 4 5 SIBCL7HBkrP4llolm4SC2A 3.80"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tmpcsv = io.StringIO(\"\"\"idx Unnamed fans id stars\n",
"0 0 69 18kPq7GPye-YQ3LyKyAZPw 4.14\n",
"1 1 1345 rpOyqD_893cqmDAtJLbdog 3.67\n",
"2 2 105 4U9kSBLuBDU391x6bxU-YA 3.68\n",
"3 3 2 fHtTaujcyKvXglE33Z5yIw 4.64\n",
"4 4 5 SIBCL7HBkrP4llolm4SC2A 3.80\"\"\")\n",
"\n",
"op = pd.read_csv(tmpcsv, delim_whitespace=True)\n",
"op"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
" <div class=\"bk-root\">\n",
" <div class=\"plotdiv\" id=\"179512cc-1528-4080-9ce8-14ab19016f0a\"></div>\n",
" </div>\n",
"<script type=\"text/javascript\">\n",
" \n",
" (function(global) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
" \n",
" var force = \"\";\n",
" \n",
" if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force !== \"\") {\n",
" window._bokeh_onload_callbacks = [];\n",
" window._bokeh_is_loading = undefined;\n",
" }\n",
" \n",
" \n",
" \n",
" if (typeof (window._bokeh_timeout) === \"undefined\" || force !== \"\") {\n",
" window._bokeh_timeout = Date.now() + 0;\n",
" window._bokeh_failed_load = false;\n",
" }\n",
" \n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
" \n",
" function display_loaded() {\n",
" if (window.Bokeh !== undefined) {\n",
" Bokeh.$(\"#179512cc-1528-4080-9ce8-14ab19016f0a\").text(\"BokehJS successfully loaded.\");\n",
" } else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(display_loaded, 100)\n",
" }\n",
" }\n",
" \n",
" function run_callbacks() {\n",
" window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
" delete window._bokeh_onload_callbacks\n",
" console.info(\"Bokeh: all callbacks have finished\");\n",
" }\n",
" \n",
" function load_libs(js_urls, callback) {\n",
" window._bokeh_onload_callbacks.push(callback);\n",
" if (window._bokeh_is_loading > 0) {\n",
" console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
" return null;\n",
" }\n",
" if (js_urls == null || js_urls.length === 0) {\n",
" run_callbacks();\n",
" return null;\n",
" }\n",
" console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
" window._bokeh_is_loading = js_urls.length;\n",
" for (var i = 0; i < js_urls.length; i++) {\n",
" var url = js_urls[i];\n",
" var s = document.createElement('script');\n",
" s.src = url;\n",
" s.async = false;\n",
" s.onreadystatechange = s.onload = function() {\n",
" window._bokeh_is_loading--;\n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
" run_callbacks()\n",
" }\n",
" };\n",
" s.onerror = function() {\n",
" console.warn(\"failed to load library \" + url);\n",
" };\n",
" console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
" }\n",
" };var element = document.getElementById(\"179512cc-1528-4080-9ce8-14ab19016f0a\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '179512cc-1528-4080-9ce8-14ab19016f0a' but no matching script tag was found. \")\n",
" return false;\n",
" }\n",
" \n",
" var js_urls = [];\n",
" \n",
" var inline_js = [\n",
" function(Bokeh) {\n",
" Bokeh.$(function() {\n",
" var docs_json = {\"38c93d32-7db7-4874-99df-2a22ac989133\":{\"roots\":{\"references\":[{\"attributes\":{\"callback\":null,\"column_names\":[\"y\",\"x\",\"fill_color\"],\"data\":{\"fill_color\":[\"#3aa896\",\"#39aa096\",\"#39f096\",\"#3b2296\",\"#392896\"],\"x\":[4.14,3.67,3.68,4.64,3.8],\"y\":[69,1345,105,2,5]}},\"id\":\"3a97b647-4db3-434a-8897-b3a988769564\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"ac7e9b1f-65d6-452c-9d5d-c6b033d20e9d\",\"type\":\"CrosshairTool\"},{\"attributes\":{\"callback\":null},\"id\":\"09b40b11-f259-4b63-8926-e216ec523e05\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"e8102549-6022-4bc7-bdbd-66517777759f\",\"type\":\"BasicTicker\"},{\"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\":\"41f27201-94e6-477d-b599-9afc04cf887d\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"plot\":null,\"text\":null},\"id\":\"3f5c7633-8459-47ea-b005-99b57a239924\",\"type\":\"Title\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"11f20539-30fd-4cb0-bba0-8135c8834a53\",\"type\":\"BasicTicker\"}},\"id\":\"20ee1647-acf5-447d-afbe-53de654f1f24\",\"type\":\"Grid\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.6},\"fill_color\":{\"field\":\"fill_color\"},\"line_color\":{\"value\":null},\"radius\":{\"units\":\"data\",\"value\":1.5},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3be390a5-cf59-49bb-b5d6-f4d08c9f0ca4\",\"type\":\"Circle\"},{\"attributes\":{\"callback\":null,\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"d6b07ccc-53a7-4086-b018-5a121df6b286\",\"type\":\"TapTool\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"909180d9-de7d-403d-857b-2567c17c8391\",\"type\":\"ZoomInTool\"},{\"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\":\"ac3cba51-52a8-48f1-92e7-895fdde81b96\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"c323b16b-b019-4234-9815-c52a7e7871fd\",\"type\":\"ZoomOutTool\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"e8102549-6022-4bc7-bdbd-66517777759f\",\"type\":\"BasicTicker\"}},\"id\":\"784d84d7-55ae-4e7e-bffa-46376b37fa6b\",\"type\":\"Grid\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"xs_units\":\"screen\",\"ys_units\":\"screen\"},\"id\":\"6e45b9f3-2ab4-4071-9c30-ff8bc7f99a27\",\"type\":\"PolyAnnotation\"},{\"attributes\":{\"formatter\":{\"id\":\"0b26f81f-c7bc-46a6-b423-adea25da8d50\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"11f20539-30fd-4cb0-bba0-8135c8834a53\",\"type\":\"BasicTicker\"}},\"id\":\"7dc5b398-4f8c-47ab-a8d5-1e38f803952c\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data_source\":{\"id\":\"3a97b647-4db3-434a-8897-b3a988769564\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"3be390a5-cf59-49bb-b5d6-f4d08c9f0ca4\",\"type\":\"Circle\"},\"hover_glyph\":null,\"nonselection_glyph\":{\"id\":\"f29e129f-4ef5-4ee2-8885-681e45911274\",\"type\":\"Circle\"},\"selection_glyph\":null},\"id\":\"c2097def-c738-4d45-b1f1-9788a5f60e58\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"5b3e7b07-2950-4bfa-a123-b6c89a28bc12\",\"type\":\"UndoTool\"},{\"attributes\":{\"overlay\":{\"id\":\"6e45b9f3-2ab4-4071-9c30-ff8bc7f99a27\",\"type\":\"PolyAnnotation\"},\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"1ca86481-cd0b-4696-81a1-a3c8684b6e25\",\"type\":\"PolySelectTool\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"08029070-578c-4815-86f0-84a53f7b58b5\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"abfcc493-1c95-4bbc-8875-73478ae3c75b\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"11f20539-30fd-4cb0-bba0-8135c8834a53\",\"type\":\"BasicTicker\"},{\"attributes\":{\"callback\":null},\"id\":\"23453195-480d-42d9-9613-d82ab169c12a\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"xs_units\":\"screen\",\"ys_units\":\"screen\"},\"id\":\"5c9bc0b8-4bfc-4072-ad78-fbc8c1375f06\",\"type\":\"PolyAnnotation\"},{\"attributes\":{\"below\":[{\"id\":\"7dc5b398-4f8c-47ab-a8d5-1e38f803952c\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"f8e2c393-9d9f-4bc9-b183-e4dfa11e47df\",\"type\":\"LinearAxis\"}],\"renderers\":[{\"id\":\"7dc5b398-4f8c-47ab-a8d5-1e38f803952c\",\"type\":\"LinearAxis\"},{\"id\":\"20ee1647-acf5-447d-afbe-53de654f1f24\",\"type\":\"Grid\"},{\"id\":\"f8e2c393-9d9f-4bc9-b183-e4dfa11e47df\",\"type\":\"LinearAxis\"},{\"id\":\"784d84d7-55ae-4e7e-bffa-46376b37fa6b\",\"type\":\"Grid\"},{\"id\":\"41f27201-94e6-477d-b599-9afc04cf887d\",\"type\":\"BoxAnnotation\"},{\"id\":\"ac3cba51-52a8-48f1-92e7-895fdde81b96\",\"type\":\"BoxAnnotation\"},{\"id\":\"6e45b9f3-2ab4-4071-9c30-ff8bc7f99a27\",\"type\":\"PolyAnnotation\"},{\"id\":\"5c9bc0b8-4bfc-4072-ad78-fbc8c1375f06\",\"type\":\"PolyAnnotation\"},{\"id\":\"c2097def-c738-4d45-b1f1-9788a5f60e58\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"3f5c7633-8459-47ea-b005-99b57a239924\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"c5ad156b-0307-42a8-a397-fb4117516814\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"fdad75da-2b85-4750-bda7-3ed01d532ab9\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"09b40b11-f259-4b63-8926-e216ec523e05\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"23453195-480d-42d9-9613-d82ab169c12a\",\"type\":\"DataRange1d\"}},\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"1e823f9f-c08d-47d4-aa75-aafcf9fcaf15\",\"type\":\"PanTool\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"b05858a5-001f-4090-ad65-d8254ea11ec9\",\"type\":\"RedoTool\"},{\"attributes\":{\"formatter\":{\"id\":\"abfcc493-1c95-4bbc-8875-73478ae3c75b\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"e8102549-6022-4bc7-bdbd-66517777759f\",\"type\":\"BasicTicker\"}},\"id\":\"f8e2c393-9d9f-4bc9-b183-e4dfa11e47df\",\"type\":\"LinearAxis\"},{\"attributes\":{\"callback\":null,\"overlay\":{\"id\":\"ac3cba51-52a8-48f1-92e7-895fdde81b96\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"renderers\":[{\"id\":\"c2097def-c738-4d45-b1f1-9788a5f60e58\",\"type\":\"GlyphRenderer\"}]},\"id\":\"fca828a5-f81f-4241-9abb-68656458e985\",\"type\":\"BoxSelectTool\"},{\"attributes\":{\"overlay\":{\"id\":\"41f27201-94e6-477d-b599-9afc04cf887d\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"0138b106-cb0c-4c48-9cf9-8a11e2825859\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"callback\":null,\"overlay\":{\"id\":\"5c9bc0b8-4bfc-4072-ad78-fbc8c1375f06\",\"type\":\"PolyAnnotation\"},\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"12e88ebf-d49c-4d8f-9810-02b12e0f206e\",\"type\":\"LassoSelectTool\"},{\"attributes\":{\"callback\":null,\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"b9fc4a90-ed50-4555-92a4-6bff7f1275dc\",\"type\":\"HoverTool\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"0dfe0225-5567-4cb2-9290-a111a538de82\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"c5ad156b-0307-42a8-a397-fb4117516814\",\"type\":\"ToolEvents\"},{\"attributes\":{\"plot\":{\"id\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"dd3c89d0-4340-471e-8727-3fc8c653b60f\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"radius\":{\"units\":\"data\",\"value\":1.5},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"f29e129f-4ef5-4ee2-8885-681e45911274\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"0b26f81f-c7bc-46a6-b423-adea25da8d50\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"b9fc4a90-ed50-4555-92a4-6bff7f1275dc\",\"type\":\"HoverTool\"},{\"id\":\"ac7e9b1f-65d6-452c-9d5d-c6b033d20e9d\",\"type\":\"CrosshairTool\"},{\"id\":\"1e823f9f-c08d-47d4-aa75-aafcf9fcaf15\",\"type\":\"PanTool\"},{\"id\":\"08029070-578c-4815-86f0-84a53f7b58b5\",\"type\":\"WheelZoomTool\"},{\"id\":\"909180d9-de7d-403d-857b-2567c17c8391\",\"type\":\"ZoomInTool\"},{\"id\":\"c323b16b-b019-4234-9815-c52a7e7871fd\",\"type\":\"ZoomOutTool\"},{\"id\":\"0138b106-cb0c-4c48-9cf9-8a11e2825859\",\"type\":\"BoxZoomTool\"},{\"id\":\"5b3e7b07-2950-4bfa-a123-b6c89a28bc12\",\"type\":\"UndoTool\"},{\"id\":\"b05858a5-001f-4090-ad65-d8254ea11ec9\",\"type\":\"RedoTool\"},{\"id\":\"0dfe0225-5567-4cb2-9290-a111a538de82\",\"type\":\"ResetTool\"},{\"id\":\"d6b07ccc-53a7-4086-b018-5a121df6b286\",\"type\":\"TapTool\"},{\"id\":\"dd3c89d0-4340-471e-8727-3fc8c653b60f\",\"type\":\"SaveTool\"},{\"id\":\"fca828a5-f81f-4241-9abb-68656458e985\",\"type\":\"BoxSelectTool\"},{\"id\":\"1ca86481-cd0b-4696-81a1-a3c8684b6e25\",\"type\":\"PolySelectTool\"},{\"id\":\"12e88ebf-d49c-4d8f-9810-02b12e0f206e\",\"type\":\"LassoSelectTool\"}]},\"id\":\"fdad75da-2b85-4750-bda7-3ed01d532ab9\",\"type\":\"Toolbar\"}],\"root_ids\":[\"41ef080a-0f44-41af-9be5-045c29cfdb56\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.3\"}};\n",
" var render_items = [{\"docid\":\"38c93d32-7db7-4874-99df-2a22ac989133\",\"elementid\":\"179512cc-1528-4080-9ce8-14ab19016f0a\",\"modelid\":\"41ef080a-0f44-41af-9be5-045c29cfdb56\"}];\n",
" \n",
" Bokeh.embed.embed_items(docs_json, render_items);\n",
" });\n",
" },\n",
" function(Bokeh) {\n",
" }\n",
" ];\n",
" \n",
" function run_inline_js() {\n",
" \n",
" if ((window.Bokeh !== undefined) || (force === \"1\")) {\n",
" for (var i = 0; i < inline_js.length; i++) {\n",
" inline_js[i](window.Bokeh);\n",
" }if (force === \"1\") {\n",
" display_loaded();\n",
" }} else if (Date.now() < window._bokeh_timeout) {\n",
" setTimeout(run_inline_js, 100);\n",
" } else if (!window._bokeh_failed_load) {\n",
" console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
" window._bokeh_failed_load = true;\n",
" } else if (!force) {\n",
" var cell = $(\"#179512cc-1528-4080-9ce8-14ab19016f0a\").parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
" \n",
" }\n",
" \n",
" if (window._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
" }(this));\n",
"</script>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x = op.stars\n",
"y = op.fans\n",
"\n",
"radii = 1.5\n",
"colors = [\"#%02x%02x%02x\" % (int(r), int(g), 150) for r, g in zip(50+2*x, 30+2*y)]\n",
"\n",
"TOOLS=\"hover,crosshair,pan,wheel_zoom,zoom_in,zoom_out,box_zoom,undo,redo,reset,tap,save,box_select,poly_select,lasso_select,\"\n",
"\n",
"p = figure(tools=TOOLS)\n",
"\n",
"p.scatter(x, y, radius=radii,\n",
" fill_color=colors, fill_alpha=0.6,\n",
" line_color=None)\n",
"\n",
"#output_file(\"color_scatter.html\", title=\"color_scatter.py example\")\n",
"\n",
"show(p)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.5"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment