Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AndradeEduardo/b5c451f7de7b3c32cf729fb40bdc33f2 to your computer and use it in GitHub Desktop.
Save AndradeEduardo/b5c451f7de7b3c32cf729fb40bdc33f2 to your computer and use it in GitHub Desktop.
Depicting the net income of some Brazilian states as a line graph. The lines are hidden or shown with mouse clicks on legends.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The objective of this notebook is to make a proof of concept by using the Bokeh library to depict the net income growth of some Brazilian states. In the resulting graph above, we can see that pure line graphs are not suitable for the task, as the number of states is large (only 8 out of the 27 Brazilian states are represented there)."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from pandas import ExcelFile\n",
"import numpy as np\n",
"\n",
"from bokeh.palettes import Spectral, brewer, Set3\n",
"from bokeh.plotting import figure, output_file, show\n",
"from bokeh.io import output_notebook, show\n",
"from bokeh.models import NumeralTickFormatter"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div class=\"bk-root\">\n",
" <a href=\"https://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
" <span id=\"1a1bedcc-6dc8-4e75-98fe-e275db0853e7\">Loading BokehJS ...</span>\n",
" </div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function(root) {\n",
" function now() {\n",
" return new Date();\n",
" }\n",
"\n",
" var force = true;\n",
"\n",
" if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
" root._bokeh_onload_callbacks = [];\n",
" root._bokeh_is_loading = undefined;\n",
" }\n",
"\n",
" var JS_MIME_TYPE = 'application/javascript';\n",
" var HTML_MIME_TYPE = 'text/html';\n",
" var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
" var CLASS_NAME = 'output_bokeh rendered_html';\n",
"\n",
" /**\n",
" * Render data to the DOM node\n",
" */\n",
" function render(props, node) {\n",
" var script = document.createElement(\"script\");\n",
" node.appendChild(script);\n",
" }\n",
"\n",
" /**\n",
" * Handle when an output is cleared or removed\n",
" */\n",
" function handleClearOutput(event, handle) {\n",
" var cell = handle.cell;\n",
"\n",
" var id = cell.output_area._bokeh_element_id;\n",
" var server_id = cell.output_area._bokeh_server_id;\n",
" // Clean up Bokeh references\n",
" if (id !== undefined) {\n",
" Bokeh.index[id].model.document.clear();\n",
" delete Bokeh.index[id];\n",
" }\n",
"\n",
" if (server_id !== undefined) {\n",
" // Clean up Bokeh references\n",
" var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
" cell.notebook.kernel.execute(cmd, {\n",
" iopub: {\n",
" output: function(msg) {\n",
" var element_id = msg.content.text.trim();\n",
" Bokeh.index[element_id].model.document.clear();\n",
" delete Bokeh.index[element_id];\n",
" }\n",
" }\n",
" });\n",
" // Destroy server and session\n",
" var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
" cell.notebook.kernel.execute(cmd);\n",
" }\n",
" }\n",
"\n",
" /**\n",
" * Handle when a new output is added\n",
" */\n",
" function handleAddOutput(event, handle) {\n",
" var output_area = handle.output_area;\n",
" var output = handle.output;\n",
"\n",
" // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
" if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
" return\n",
" }\n",
"\n",
" var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
"\n",
" if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
" toinsert[0].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
" // store reference to embed id on output_area\n",
" output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
" }\n",
" if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
" var bk_div = document.createElement(\"div\");\n",
" bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
" var script_attrs = bk_div.children[0].attributes;\n",
" for (var i = 0; i < script_attrs.length; i++) {\n",
" toinsert[0].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
" }\n",
" // store reference to server id on output_area\n",
" output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
" }\n",
" }\n",
"\n",
" function register_renderer(events, OutputArea) {\n",
"\n",
" function append_mime(data, metadata, element) {\n",
" // create a DOM node to render to\n",
" var toinsert = this.create_output_subarea(\n",
" metadata,\n",
" CLASS_NAME,\n",
" EXEC_MIME_TYPE\n",
" );\n",
" this.keyboard_manager.register_events(toinsert);\n",
" // Render to node\n",
" var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
" render(props, toinsert[0]);\n",
" element.append(toinsert);\n",
" return toinsert\n",
" }\n",
"\n",
" /* Handle when an output is cleared or removed */\n",
" events.on('clear_output.CodeCell', handleClearOutput);\n",
" events.on('delete.Cell', handleClearOutput);\n",
"\n",
" /* Handle when a new output is added */\n",
" events.on('output_added.OutputArea', handleAddOutput);\n",
"\n",
" /**\n",
" * Register the mime type and append_mime function with output_area\n",
" */\n",
" OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
" /* Is output safe? */\n",
" safe: true,\n",
" /* Index of renderer in `output_area.display_order` */\n",
" index: 0\n",
" });\n",
" }\n",
"\n",
" // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
" if (root.Jupyter !== undefined) {\n",
" var events = require('base/js/events');\n",
" var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
"\n",
" if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
" register_renderer(events, OutputArea);\n",
" }\n",
" }\n",
"\n",
" \n",
" if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
" root._bokeh_timeout = Date.now() + 5000;\n",
" root._bokeh_failed_load = false;\n",
" }\n",
"\n",
" var NB_LOAD_WARNING = {'data': {'text/html':\n",
" \"<div style='background-color: #fdd'>\\n\"+\n",
" \"<p>\\n\"+\n",
" \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
" \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
" \"</p>\\n\"+\n",
" \"<ul>\\n\"+\n",
" \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
" \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
" \"</ul>\\n\"+\n",
" \"<code>\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"</code>\\n\"+\n",
" \"</div>\"}};\n",
"\n",
" function display_loaded() {\n",
" var el = document.getElementById(\"1a1bedcc-6dc8-4e75-98fe-e275db0853e7\");\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(\"1a1bedcc-6dc8-4e75-98fe-e275db0853e7\");\n",
" if (element == null) {\n",
" console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1a1bedcc-6dc8-4e75-98fe-e275db0853e7' 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.14.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.14.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.14.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.14.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.14.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.14.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.14.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.14.min.css\");\n",
" console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.14.min.css\");\n",
" Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.14.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(\"1a1bedcc-6dc8-4e75-98fe-e275db0853e7\")).parents('.cell').data().cell;\n",
" cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
" }\n",
"\n",
" }\n",
"\n",
" if (root._bokeh_is_loading === 0) {\n",
" console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
" run_inline_js();\n",
" } else {\n",
" load_libs(js_urls, function() {\n",
" console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
" run_inline_js();\n",
" });\n",
" }\n",
"}(window));"
],
"application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"<div style='background-color: #fdd'>\\n\"+\n \"<p>\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"</p>\\n\"+\n \"<ul>\\n\"+\n \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n \"<li>use INLINE resources instead, as so:</li>\\n\"+\n \"</ul>\\n\"+\n \"<code>\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"</code>\\n\"+\n \"</div>\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"1a1bedcc-6dc8-4e75-98fe-e275db0853e7\");\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(\"1a1bedcc-6dc8-4e75-98fe-e275db0853e7\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '1a1bedcc-6dc8-4e75-98fe-e275db0853e7' 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.14.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.14.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.14.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.14.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.14.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.14.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.14.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.14.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.14.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.14.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(\"1a1bedcc-6dc8-4e75-98fe-e275db0853e7\")).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": 15,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Column headings:\n",
"Index(['Year', 'PersonnelExpenses', 'NetCurrentIncome', 'State', 'AlertLimit',\n",
" 'PrudentialLimit', 'MaxLimit', 'Lat', 'Long'],\n",
" dtype='object')\n"
]
}
],
"source": [
"df = pd.read_excel('BR_States_PersonelCosts.xlsx', sheet_name='PersonnelExpenses')\n",
"print(\"Column headings:\")\n",
"print(df.columns)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The items in the legend pane are clickable and the correspondent line is hidden or shown on clicks."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<div class=\"bk-root\">\n",
" <div class=\"bk-plotdiv\" id=\"de9704ee-57c1-4634-9d0f-4d83efef7a7c\"></div>\n",
"</div>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"(function(root) {\n",
" function embed_document(root) {\n",
" \n",
" var docs_json = {\"26c781fa-4ab7-466b-b4c8-ba69408315b7\":{\"roots\":{\"references\":[{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"a25cfa3e-50b8-47cf-97b3-4c88dfa4875d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"363db8d5-cf84-4a8a-84e2-2a695a583d30\",\"type\":\"BasicTicker\"}},\"id\":\"2aae78bc-69e3-42b9-9dc1-3c3655078591\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"00b4985b-69f6-45c4-a297-c6646201cd0d\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"2cf7b534-bc52-48c5-a537-f15a9ff417be\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"c4f8ccc7-5962-4ef2-aeb5-f7fa7adcb429\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"ee9e396d-6dd4-4d6e-8fd3-6a397b67ea82\",\"type\":\"CDSView\"}},\"id\":\"3c999a6a-e7b5-4511-aaef-b6b659349958\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"00b4985b-69f6-45c4-a297-c6646201cd0d\",\"type\":\"ColumnDataSource\"}},\"id\":\"ee9e396d-6dd4-4d6e-8fd3-6a397b67ea82\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"PR\"},\"renderers\":[{\"id\":\"3c999a6a-e7b5-4511-aaef-b6b659349958\",\"type\":\"GlyphRenderer\"}]},\"id\":\"60e921a5-9fcd-4d41-a478-d3474524510a\",\"type\":\"LegendItem\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[2017,2016,2015,2014,2013,2012,2011,2010,2009,2008,2007,2006,2005,2004,2003,2002],\"y\":{\"__ndarray__\":\"AAAGrphfJ0IAACql7IYlQgAAiBhq2idCAACerw1xJUIAAJBTfeolQgAAWhB/6SJCAAAazCZJIkIAAEB2fVocQgAAAK6U/BpCAADg6hKlHUIAAMAUfwEZQgAAwP2HVhhCAADgcw+CFUIAAEBSAJETQgAAIIsx2hFCAACAg2UgDEI=\",\"dtype\":\"float64\",\"shape\":[16]}}},\"id\":\"09b0bc34-629f-4631-af57-35bdb37a3893\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"6b72e9f5-7899-41d9-bfbf-9f270e9622c5\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"line_alpha\":0.8,\"line_color\":\"#fb8072\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"0d483b5b-dcec-4524-a5d2-681af62031b6\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"57121fc7-066d-4e67-b369-2b9a633b1997\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"09b0bc34-629f-4631-af57-35bdb37a3893\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"0d483b5b-dcec-4524-a5d2-681af62031b6\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"57121fc7-066d-4e67-b369-2b9a633b1997\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"11bec058-d93d-42f1-a635-b2a41d955c27\",\"type\":\"CDSView\"}},\"id\":\"b1a6958d-e7f8-4d43-be55-d91c85c9d91e\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"09b0bc34-629f-4631-af57-35bdb37a3893\",\"type\":\"ColumnDataSource\"}},\"id\":\"11bec058-d93d-42f1-a635-b2a41d955c27\",\"type\":\"CDSView\"},{\"attributes\":{\"click_policy\":\"hide\",\"items\":[{\"id\":\"8d541936-5962-4671-9f44-515bb51108f2\",\"type\":\"LegendItem\"},{\"id\":\"d7be00ab-dcd7-4aeb-815e-4fd2b6a207bc\",\"type\":\"LegendItem\"},{\"id\":\"21b36c16-115b-420e-a0ef-42fc5c5979aa\",\"type\":\"LegendItem\"},{\"id\":\"2d5345bf-267c-4a81-b03e-1546605d0605\",\"type\":\"LegendItem\"},{\"id\":\"b2166a7b-12c2-4df9-9303-4ad7d4cd0516\",\"type\":\"LegendItem\"},{\"id\":\"007f2178-995c-41c5-a467-1e764d233dee\",\"type\":\"LegendItem\"},{\"id\":\"20b24e8e-541a-4b47-b92d-b885f11caa94\",\"type\":\"LegendItem\"},{\"id\":\"60e921a5-9fcd-4d41-a478-d3474524510a\",\"type\":\"LegendItem\"}],\"location\":\"top_left\",\"plot\":{\"id\":\"a25cfa3e-50b8-47cf-97b3-4c88dfa4875d\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"5d60e6fb-9bc7-45f9-94b7-eded1b017bdb\",\"type\":\"Legend\"},{\"attributes\":{\"label\":{\"value\":\"RJ\"},\"renderers\":[{\"id\":\"b1a6958d-e7f8-4d43-be55-d91c85c9d91e\",\"type\":\"GlyphRenderer\"}]},\"id\":\"8d541936-5962-4671-9f44-515bb51108f2\",\"type\":\"LegendItem\"},{\"attributes\":{\"source\":{\"id\":\"3d53c981-0bcb-441c-87c2-924c8e4789e9\",\"type\":\"ColumnDataSource\"}},\"id\":\"222c8810-df99-4c1c-8b4a-e5bbf7880d20\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.8,\"line_color\":\"#80b1d3\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"636db3b7-b20f-4f81-a156-e8e00b43cacb\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"3d53c981-0bcb-441c-87c2-924c8e4789e9\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"636db3b7-b20f-4f81-a156-e8e00b43cacb\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"993bb77c-c1bf-41f0-91f4-70c11c88be0f\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"222c8810-df99-4c1c-8b4a-e5bbf7880d20\",\"type\":\"CDSView\"}},\"id\":\"02c402e3-5cd7-4f8b-bdec-4ec5dce8b70c\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\"},\"id\":\"0c9768cc-d39e-4f45-8de8-2ac7a0058f86\",\"type\":\"Toolbar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017],\"y\":{\"__ndarray__\":\"AAAA6xCf5EEAAABqRMLmQQAAACo/8+tBAAAAHub+70EAAABO9WXxQQAAYBTt3PNBAABQSLLT90EAAPA6DvT2QQAAQGKQmPtBAAAgTd+4/0EAAJBxA/wBQgAAqFWdPQNCAABA6UKQBEIAAKCuunwEQgAAsDrcOQVCAAAYmhNzBkI=\",\"dtype\":\"float64\",\"shape\":[16]}}},\"id\":\"3d53c981-0bcb-441c-87c2-924c8e4789e9\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"993bb77c-c1bf-41f0-91f4-70c11c88be0f\",\"type\":\"Line\"},{\"attributes\":{\"label\":{\"value\":\"AM\"},\"renderers\":[{\"id\":\"02c402e3-5cd7-4f8b-bdec-4ec5dce8b70c\",\"type\":\"GlyphRenderer\"}]},\"id\":\"d7be00ab-dcd7-4aeb-815e-4fd2b6a207bc\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.8,\"line_color\":\"#fdb462\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"8d91b998-8003-4b34-944b-b624791fe9ad\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[2017,2016,2015,2014,2013,2012,2011,2010,2009,2008,2007,2006,2005,2004,2003,2002],\"y\":{\"__ndarray__\":\"AAC0O+2KEEIAADQWd5sQQgAAUKneRAxCAAAADkTbCkIAAJBpBuwIQgAAkKZUmAZCAABIMDRtBEIAAKjVAewBQgAAwMfCS/9BAAAwuT1h/UEAADC8MnD4QQAA8CQkefZBAAAApqbC80EAAADZp0XxQQAAAIo1Xe9BAAAAEZXO7EE=\",\"dtype\":\"float64\",\"shape\":[16]}}},\"id\":\"6eb09682-f740-434d-a520-b4448620d0c9\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"a25cfa3e-50b8-47cf-97b3-4c88dfa4875d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"b7801fa7-964a-46e6-88e3-ab1a29226eb8\",\"type\":\"BasicTicker\"}},\"id\":\"d98cb904-1a59-49ee-9fec-2d72a0c5dff4\",\"type\":\"Grid\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"befa0a11-37f8-4492-9d4f-bcdda3732e04\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"6eb09682-f740-434d-a520-b4448620d0c9\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"8d91b998-8003-4b34-944b-b624791fe9ad\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"befa0a11-37f8-4492-9d4f-bcdda3732e04\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"02352ccc-083f-43c9-9794-c01d7f052e1b\",\"type\":\"CDSView\"}},\"id\":\"0b9e7fee-79fc-47df-9601-64b350b457b0\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"363db8d5-cf84-4a8a-84e2-2a695a583d30\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"b7801fa7-964a-46e6-88e3-ab1a29226eb8\",\"type\":\"BasicTicker\"},{\"attributes\":{\"source\":{\"id\":\"6eb09682-f740-434d-a520-b4448620d0c9\",\"type\":\"ColumnDataSource\"}},\"id\":\"02352ccc-083f-43c9-9794-c01d7f052e1b\",\"type\":\"CDSView\"},{\"attributes\":{\"formatter\":{\"id\":\"440c528d-b7da-4536-bf91-7db919d0fef6\",\"type\":\"NumeralTickFormatter\"},\"plot\":{\"id\":\"a25cfa3e-50b8-47cf-97b3-4c88dfa4875d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"363db8d5-cf84-4a8a-84e2-2a695a583d30\",\"type\":\"BasicTicker\"}},\"id\":\"7ab2821f-bea3-447d-9a1d-00e0fc8b816e\",\"type\":\"LinearAxis\"},{\"attributes\":{\"formatter\":{\"id\":\"6b72e9f5-7899-41d9-bfbf-9f270e9622c5\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"a25cfa3e-50b8-47cf-97b3-4c88dfa4875d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"b7801fa7-964a-46e6-88e3-ab1a29226eb8\",\"type\":\"BasicTicker\"}},\"id\":\"23383934-d903-4a7e-b8f1-47c5c43ede69\",\"type\":\"LinearAxis\"},{\"attributes\":{\"label\":{\"value\":\"CE\"},\"renderers\":[{\"id\":\"0b9e7fee-79fc-47df-9601-64b350b457b0\",\"type\":\"GlyphRenderer\"}]},\"id\":\"21b36c16-115b-420e-a0ef-42fc5c5979aa\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.8,\"line_color\":\"#b3de69\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"5d4d3c5a-00c5-4b27-b138-4cf77744550d\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[2017,2016,2015,2014,2013,2012,2011,2010,2009,2008,2007,2006,2005,2004,2003,2002],\"y\":{\"__ndarray__\":\"AACgXKUIFEIAADCfwGsTQgAAIGyNTBJCAACAu8k0EUIAAEBAMP0PQgAAgASzFA1CAABASIIbC0IAAMAa0CkHQgAAAOUtygNCAADABkClAkIAAADihez+QQAAAAxhhvtBAACAbEt+90EAAAD2KLnzQQAAgJL8PvFBAACAGrBU8EE=\",\"dtype\":\"float64\",\"shape\":[16]}}},\"id\":\"e2b9a014-07f8-4f55-a279-407dbb046e7e\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"4a15703b-9ad5-40fd-97f6-58aed8eec994\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null},\"id\":\"c6679927-2a84-4ee2-ba6b-220c69c205e0\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"9847f96a-e224-4742-a0b4-218d50ee8990\",\"type\":\"LinearScale\"},{\"attributes\":{\"data_source\":{\"id\":\"e2b9a014-07f8-4f55-a279-407dbb046e7e\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"5d4d3c5a-00c5-4b27-b138-4cf77744550d\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"4a15703b-9ad5-40fd-97f6-58aed8eec994\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"425f1b5d-0a2e-4e3b-982f-1638c925e0f1\",\"type\":\"CDSView\"}},\"id\":\"a64142ac-2fb8-40af-9d32-702dae59b0e2\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"e2b9a014-07f8-4f55-a279-407dbb046e7e\",\"type\":\"ColumnDataSource\"}},\"id\":\"425f1b5d-0a2e-4e3b-982f-1638c925e0f1\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"PE\"},\"renderers\":[{\"id\":\"a64142ac-2fb8-40af-9d32-702dae59b0e2\",\"type\":\"GlyphRenderer\"}]},\"id\":\"2d5345bf-267c-4a81-b03e-1546605d0605\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"86367e72-8db2-47d6-bd34-91a72a0894f7\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_alpha\":0.8,\"line_color\":\"#fccde5\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"5b6af24d-c37e-49fd-8a33-ee4d11b02a03\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[2012,2013,2014,2015,2016,2017],\"y\":{\"__ndarray__\":\"j8I9bCW84UEAAAAAAAD4fwAAYE08wORBAADgyp0L5UEAAMBSUCjpQQAAYIbj0edB\",\"dtype\":\"float64\",\"shape\":[6]}}},\"id\":\"66ddc2a3-3478-4631-aedd-ca8b1f51d486\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"d78daf47-1457-4c2a-a26f-163d835bd49d\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"66ddc2a3-3478-4631-aedd-ca8b1f51d486\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"5b6af24d-c37e-49fd-8a33-ee4d11b02a03\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"d78daf47-1457-4c2a-a26f-163d835bd49d\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"b73a4489-2c17-4673-b52e-55bf8948ed26\",\"type\":\"CDSView\"}},\"id\":\"61627f36-de85-4ce9-b11d-b46cc4fb62ac\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"66ddc2a3-3478-4631-aedd-ca8b1f51d486\",\"type\":\"ColumnDataSource\"}},\"id\":\"b73a4489-2c17-4673-b52e-55bf8948ed26\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"RR\"},\"renderers\":[{\"id\":\"61627f36-de85-4ce9-b11d-b46cc4fb62ac\",\"type\":\"GlyphRenderer\"}]},\"id\":\"b2166a7b-12c2-4df9-9303-4ad7d4cd0516\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.8,\"line_color\":\"#d9d9d9\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"566e47c5-0647-4624-a2fd-db923674d92e\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[2011,2012,2013,2014,2015,2016,2017],\"y\":{\"__ndarray__\":\"AACoGgVsFEIAAIByDxUWQgAAHCVckxhCAABcD8CqGkIAACgVvREcQgAABIovIyBCAAAw/cxRIEI=\",\"dtype\":\"float64\",\"shape\":[7]}}},\"id\":\"de03b85e-4e2e-44ae-a3d4-712c3a893953\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":null,\"text\":\"Net Current Income per State in BR$\"},\"id\":\"1670497c-638d-4ad7-9f3f-9bb369abe902\",\"type\":\"Title\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"b6e590b7-4906-43dc-b3b3-f79b3ad1051d\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"de03b85e-4e2e-44ae-a3d4-712c3a893953\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"566e47c5-0647-4624-a2fd-db923674d92e\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"b6e590b7-4906-43dc-b3b3-f79b3ad1051d\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"51808a64-590e-4903-9592-95af68234f9f\",\"type\":\"CDSView\"}},\"id\":\"52d7805c-8cf4-45cf-8a9e-bf0c104a3633\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"de03b85e-4e2e-44ae-a3d4-712c3a893953\",\"type\":\"ColumnDataSource\"}},\"id\":\"51808a64-590e-4903-9592-95af68234f9f\",\"type\":\"CDSView\"},{\"attributes\":{\"below\":[{\"id\":\"23383934-d903-4a7e-b8f1-47c5c43ede69\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"7ab2821f-bea3-447d-9a1d-00e0fc8b816e\",\"type\":\"LinearAxis\"}],\"plot_height\":500,\"plot_width\":750,\"renderers\":[{\"id\":\"23383934-d903-4a7e-b8f1-47c5c43ede69\",\"type\":\"LinearAxis\"},{\"id\":\"d98cb904-1a59-49ee-9fec-2d72a0c5dff4\",\"type\":\"Grid\"},{\"id\":\"7ab2821f-bea3-447d-9a1d-00e0fc8b816e\",\"type\":\"LinearAxis\"},{\"id\":\"2aae78bc-69e3-42b9-9dc1-3c3655078591\",\"type\":\"Grid\"},{\"id\":\"5d60e6fb-9bc7-45f9-94b7-eded1b017bdb\",\"type\":\"Legend\"},{\"id\":\"b1a6958d-e7f8-4d43-be55-d91c85c9d91e\",\"type\":\"GlyphRenderer\"},{\"id\":\"02c402e3-5cd7-4f8b-bdec-4ec5dce8b70c\",\"type\":\"GlyphRenderer\"},{\"id\":\"0b9e7fee-79fc-47df-9601-64b350b457b0\",\"type\":\"GlyphRenderer\"},{\"id\":\"a64142ac-2fb8-40af-9d32-702dae59b0e2\",\"type\":\"GlyphRenderer\"},{\"id\":\"61627f36-de85-4ce9-b11d-b46cc4fb62ac\",\"type\":\"GlyphRenderer\"},{\"id\":\"52d7805c-8cf4-45cf-8a9e-bf0c104a3633\",\"type\":\"GlyphRenderer\"},{\"id\":\"497d0ee1-2f2f-44bf-b0ec-6331e71bbdfa\",\"type\":\"GlyphRenderer\"},{\"id\":\"3c999a6a-e7b5-4511-aaef-b6b659349958\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"1670497c-638d-4ad7-9f3f-9bb369abe902\",\"type\":\"Title\"},\"toolbar\":{\"id\":\"0c9768cc-d39e-4f45-8de8-2ac7a0058f86\",\"type\":\"Toolbar\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"092453e9-5661-4eca-a7cf-bca9913a4510\",\"type\":\"DataRange1d\"},\"x_scale\":{\"id\":\"9847f96a-e224-4742-a0b4-218d50ee8990\",\"type\":\"LinearScale\"},\"y_range\":{\"id\":\"c6679927-2a84-4ee2-ba6b-220c69c205e0\",\"type\":\"DataRange1d\"},\"y_scale\":{\"id\":\"86367e72-8db2-47d6-bd34-91a72a0894f7\",\"type\":\"LinearScale\"}},\"id\":\"a25cfa3e-50b8-47cf-97b3-4c88dfa4875d\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"label\":{\"value\":\"RS\"},\"renderers\":[{\"id\":\"52d7805c-8cf4-45cf-8a9e-bf0c104a3633\",\"type\":\"GlyphRenderer\"}]},\"id\":\"007f2178-995c-41c5-a467-1e764d233dee\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.8,\"line_color\":\"#bc80bd\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1130d428-4e59-4a9c-ac70-dbef4bc357af\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017],\"y\":{\"__ndarray__\":\"AACAefFK8EEAAABh8hvzQQAAAJGQHvVBAAAAZhd7+0EAAAD+p6j/QQAAAPwTaQNCAAAAK85hA0IAAOgoLxYGQgAAACvOYQNCAABYtUmwCUIAALg96RILQgAA+Jdbmg1CAADMM1GcEEIAAMSBrBMSQgAAMLTsFBNCAACgkFKuE0I=\",\"dtype\":\"float64\",\"shape\":[16]}}},\"id\":\"0daaf621-02b7-4767-8ff3-3601bea82808\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"51090cb7-f944-47cf-ada4-0487059c7d3d\",\"type\":\"Line\"},{\"attributes\":{\"format\":\"$0.0a\"},\"id\":\"440c528d-b7da-4536-bf91-7db919d0fef6\",\"type\":\"NumeralTickFormatter\"},{\"attributes\":{\"data_source\":{\"id\":\"0daaf621-02b7-4767-8ff3-3601bea82808\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"1130d428-4e59-4a9c-ac70-dbef4bc357af\",\"type\":\"Line\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"51090cb7-f944-47cf-ada4-0487059c7d3d\",\"type\":\"Line\"},\"selection_glyph\":null,\"view\":{\"id\":\"dc3af8bc-d24a-4229-ab26-ddce07818038\",\"type\":\"CDSView\"}},\"id\":\"497d0ee1-2f2f-44bf-b0ec-6331e71bbdfa\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"0daaf621-02b7-4767-8ff3-3601bea82808\",\"type\":\"ColumnDataSource\"}},\"id\":\"dc3af8bc-d24a-4229-ab26-ddce07818038\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"SC\"},\"renderers\":[{\"id\":\"497d0ee1-2f2f-44bf-b0ec-6331e71bbdfa\",\"type\":\"GlyphRenderer\"}]},\"id\":\"20b24e8e-541a-4b47-b92d-b885f11caa94\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"c4f8ccc7-5962-4ef2-aeb5-f7fa7adcb429\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.8,\"line_color\":\"#ccebc5\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2cf7b534-bc52-48c5-a537-f15a9ff417be\",\"type\":\"Line\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"y\"],\"data\":{\"x\":[2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017],\"y\":{\"__ndarray__\":\"AACATcrn+0EAAABz0yv/QQAAAJlZOAFCAAAo/tF4A0IAAChSPj8FQgAAAEjSOQdCAACA9uj5CkIAAKDcohwMQgAA2BiXmA9CAAC0jQpcEkIAANCOOVkUQgAAAAAAAPh/AADA1/5jGkIAAOBQ668dQgAAAAAAAPh/AACciuEMIUI=\",\"dtype\":\"float64\",\"shape\":[16]}}},\"id\":\"00b4985b-69f6-45c4-a297-c6646201cd0d\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"callback\":null},\"id\":\"092453e9-5661-4eca-a7cf-bca9913a4510\",\"type\":\"DataRange1d\"}],\"root_ids\":[\"a25cfa3e-50b8-47cf-97b3-4c88dfa4875d\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.14\"}};\n",
" var render_items = [{\"docid\":\"26c781fa-4ab7-466b-b4c8-ba69408315b7\",\"elementid\":\"de9704ee-57c1-4634-9d0f-4d83efef7a7c\",\"modelid\":\"a25cfa3e-50b8-47cf-97b3-4c88dfa4875d\"}];\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": "a25cfa3e-50b8-47cf-97b3-4c88dfa4875d"
}
},
"output_type": "display_data"
}
],
"source": [
"states = df['State'].unique()\n",
"lcolor = 3\n",
"\n",
"p = figure(plot_width=750, plot_height=500, tools=\"\",\n",
" toolbar_location=None, title='Net Current Income per State in BR$')\n",
"\n",
"for state in states:\n",
" df_state = df.loc[df['State'] == state]\n",
" p.line(df_state['Year'], df_state['NetCurrentIncome'], line_width=2,\n",
" color=Set3[12][lcolor], alpha=0.8, legend=state)\n",
" lcolor = lcolor + 1\n",
"\n",
"p.yaxis[0].formatter = NumeralTickFormatter(format=\"$0.0a\")\n",
"p.legend.location = \"top_left\"\n",
"p.legend.click_policy=\"hide\"\n",
"show(p)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment