Skip to content

Instantly share code, notes, and snippets.

@sanjaysheel
Created December 13, 2019 15:47
Show Gist options
  • Save sanjaysheel/4fd509b04f9451b120e932f6fba41aca to your computer and use it in GitHub Desktop.
Save sanjaysheel/4fd509b04f9451b120e932f6fba41aca to your computer and use it in GitHub Desktop.
Created on Cognitive Class Labs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bokeh Plot</title>
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-1.4.0.min.js"></script>
<script type="text/javascript">
Bokeh.set_log_level("info");
</script>
</head>
<body>
<div class="bk-root" id="e812c021-841d-447b-a04b-4db853d54475" data-root-id="1729"></div>
<script type="application/json" id="1910">
{"84ad6303-6e5b-41a4-aa0d-326d014774b1":{"roots":{"references":[{"attributes":{"source":{"id":"1776","type":"ColumnDataSource"}},"id":"1780","type":"CDSView"},{"attributes":{"label":{"value":"% GDP change"},"renderers":[{"id":"1766","type":"GlyphRenderer"}]},"id":"1775","type":"LegendItem"},{"attributes":{"data_source":{"id":"1776","type":"ColumnDataSource"},"glyph":{"id":"1777","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1778","type":"Line"},"selection_glyph":null,"view":{"id":"1780","type":"CDSView"}},"id":"1779","type":"GlyphRenderer"},{"attributes":{},"id":"1772","type":"BasicTickFormatter"},{"attributes":{},"id":"1786","type":"Selection"},{"attributes":{},"id":"1738","type":"LinearScale"},{"attributes":{"label":{"value":"% unemployed"},"renderers":[{"id":"1779","type":"GlyphRenderer"}]},"id":"1789","type":"LegendItem"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":4,"x":{"field":"x"},"y":{"field":"y"}},"id":"1765","type":"Line"},{"attributes":{},"id":"1753","type":"SaveTool"},{"attributes":{"ticker":{"id":"1741","type":"BasicTicker"}},"id":"1744","type":"Grid"},{"attributes":{},"id":"1754","type":"ResetTool"},{"attributes":{},"id":"1755","type":"HelpTool"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":4,"x":{"field":"x"},"y":{"field":"y"}},"id":"1778","type":"Line"},{"attributes":{},"id":"1798","type":"UnionRenderers"},{"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},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1773","type":"BoxAnnotation"},{"attributes":{"line_color":"#1f77b4","line_width":4,"x":{"field":"x"},"y":{"field":"y"}},"id":"1777","type":"Line"},{"attributes":{"items":[{"id":"1775","type":"LegendItem"},{"id":"1789","type":"LegendItem"}]},"id":"1774","type":"Legend"},{"attributes":{"callback":null},"id":"1732","type":"DataRange1d"},{"attributes":{"callback":null,"data":{"x":[1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016],"y":{"__ndarray__":"ZmZmZmZm5r8AAAAAAAAkQGZmZmZmZi9AmpmZmZmZF0AAAAAAAAAYQDMzMzMzM9M/zczMzMzMIUBmZmZmZmYWQAAAAAAAABZAAAAAAAAA+D/NzMzMzMwgQAAAAAAAABBAmpmZmZmZDUCamZmZmZkdQGZmZmZmZhZAmpmZmZmZHUDNzMzMzMwgQDMzMzMzMyNAzczMzMzMFkDNzMzMzMwiQGZmZmZmZiBAAAAAAAAAFkAAAAAAAAAhQJqZmZmZmSNAzczMzMzMJkDNzMzMzMwgQAAAAAAAACJAZmZmZmZmJkAzMzMzMzMmQAAAAAAAACpAZmZmZmZmJ0CamZmZmZkhQGZmZmZmZihAMzMzMzMzEUBmZmZmZmYhQDMzMzMzMyZAAAAAAAAAHkAAAAAAAAAWQAAAAAAAABhAmpmZmZmZH0DNzMzMzMweQM3MzMzMzBZAZmZmZmZmCkCamZmZmZkXQM3MzMzMzBRAMzMzMzMzGUAzMzMzMzMTQM3MzMzMzBZAzczMzMzMGEDNzMzMzMwWQDMzMzMzMxlAAAAAAAAAGkCamZmZmZkJQDMzMzMzMwtAMzMzMzMzE0BmZmZmZmYaQM3MzMzMzBpAAAAAAAAAGEBmZmZmZmYSQM3MzMzMzPw/zczMzMzM/L9mZmZmZmYOQJqZmZmZmQ1AzczMzMzMEEDNzMzMzMwMQJqZmZmZmRFAAAAAAAAAEECamZmZmZkFQM3MzMzMzBBA","dtype":"float64","shape":[69]}},"selected":{"id":"1786","type":"Selection"},"selection_policy":{"id":"1787","type":"UnionRenderers"}},"id":"1763","type":"ColumnDataSource"},{"attributes":{"overlay":{"id":"1773","type":"BoxAnnotation"}},"id":"1752","type":"BoxZoomTool"},{"attributes":{"callback":null},"id":"1734","type":"DataRange1d"},{"attributes":{"dimension":1,"ticker":{"id":"1746","type":"BasicTicker"}},"id":"1749","type":"Grid"},{"attributes":{},"id":"1741","type":"BasicTicker"},{"attributes":{"text":"GDP and Unemployment"},"id":"1730","type":"Title"},{"attributes":{"callback":null,"data":{"x":[1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016],"y":{"__ndarray__":"qqqqqqpqI0AzMzMzMzMjQBERERERkSJAd3d3d3c3I0De3d3d3d0hQA==","dtype":"float64","shape":[5]}},"selected":{"id":"1797","type":"Selection"},"selection_policy":{"id":"1798","type":"UnionRenderers"}},"id":"1776","type":"ColumnDataSource"},{"attributes":{},"id":"1746","type":"BasicTicker"},{"attributes":{},"id":"1736","type":"LinearScale"},{"attributes":{"data_source":{"id":"1763","type":"ColumnDataSource"},"glyph":{"id":"1764","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1765","type":"Line"},"selection_glyph":null,"view":{"id":"1767","type":"CDSView"}},"id":"1766","type":"GlyphRenderer"},{"attributes":{},"id":"1797","type":"Selection"},{"attributes":{"line_color":"firebrick","line_width":4,"x":{"field":"x"},"y":{"field":"y"}},"id":"1764","type":"Line"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1750","type":"PanTool"},{"id":"1751","type":"WheelZoomTool"},{"id":"1752","type":"BoxZoomTool"},{"id":"1753","type":"SaveTool"},{"id":"1754","type":"ResetTool"},{"id":"1755","type":"HelpTool"}]},"id":"1756","type":"Toolbar"},{"attributes":{},"id":"1750","type":"PanTool"},{"attributes":{},"id":"1787","type":"UnionRenderers"},{"attributes":{"below":[{"id":"1740","type":"LinearAxis"}],"center":[{"id":"1744","type":"Grid"},{"id":"1749","type":"Grid"},{"id":"1774","type":"Legend"}],"left":[{"id":"1745","type":"LinearAxis"}],"renderers":[{"id":"1766","type":"GlyphRenderer"},{"id":"1779","type":"GlyphRenderer"}],"title":{"id":"1730","type":"Title"},"toolbar":{"id":"1756","type":"Toolbar"},"x_range":{"id":"1732","type":"DataRange1d"},"x_scale":{"id":"1736","type":"LinearScale"},"y_range":{"id":"1734","type":"DataRange1d"},"y_scale":{"id":"1738","type":"LinearScale"}},"id":"1729","subtype":"Figure","type":"Plot"},{"attributes":{"axis_label":"%","formatter":{"id":"1770","type":"BasicTickFormatter"},"ticker":{"id":"1746","type":"BasicTicker"}},"id":"1745","type":"LinearAxis"},{"attributes":{"axis_label":"year","formatter":{"id":"1772","type":"BasicTickFormatter"},"ticker":{"id":"1741","type":"BasicTicker"}},"id":"1740","type":"LinearAxis"},{"attributes":{"source":{"id":"1763","type":"ColumnDataSource"}},"id":"1767","type":"CDSView"},{"attributes":{},"id":"1751","type":"WheelZoomTool"},{"attributes":{},"id":"1770","type":"BasicTickFormatter"}],"root_ids":["1729"]},"title":"Bokeh Application","version":"1.4.0"}}
</script>
<script type="text/javascript">
(function() {
var fn = function() {
Bokeh.safely(function() {
(function(root) {
function embed_document(root) {
var docs_json = document.getElementById('1910').textContent;
var render_items = [{"docid":"84ad6303-6e5b-41a4-aa0d-326d014774b1","roots":{"1729":"e812c021-841d-447b-a04b-4db853d54475"}}];
root.Bokeh.embed.embed_items(docs_json, render_items);
}
if (root.Bokeh !== undefined) {
embed_document(root);
} else {
var attempts = 0;
var timer = setInterval(function(root) {
if (root.Bokeh !== undefined) {
clearInterval(timer);
embed_document(root);
} else {
attempts++;
if (attempts > 100) {
clearInterval(timer);
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
}
}
}, 10, root)
}
})(window);
});
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment