Skip to content

Instantly share code, notes, and snippets.

@hafen
Created February 4, 2016 07:23
Show Gist options
  • Save hafen/74c0fe32e6f6c219a88c to your computer and use it in GitHub Desktop.
Save hafen/74c0fe32e6f6c219a88c to your computer and use it in GitHub Desktop.
NYC
gmap(lat = 40.73306, lng = -73.97351, zoom = 12,
  width = 680, height = 600)
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.pydata.org/bokeh/release/bokeh-0.11.0.min.js"></script>
<link href="https://cdn.pydata.org/bokeh/release/bokeh-0.11.0.min.css" rel="stylesheet">
</head>
<body>
<div id="1920c388364a50a9813af5bc98ec4384" class="plotdiv"></div>
<script type="text/javascript">
Bokeh.$(function() {
var modelid = "6c8d69120b9d12b04fe59b085b539ee9";
var elementid = "1920c388364a50a9813af5bc98ec4384";
var docid = "1935f1faffab495d3268a97186c2e9ea";
var docs_json = JSON.parse('{"1935f1faffab495d3268a97186c2e9ea":{"version":"0.11.0","title":"Bokeh Figure","roots":{"root_ids":["6c8d69120b9d12b04fe59b085b539ee9"],"references":[{"type":"GMapPlot","id":"6c8d69120b9d12b04fe59b085b539ee9","attributes":{"title":null,"id":"6c8d69120b9d12b04fe59b085b539ee9","plot_width":670,"plot_height":554,"x_range":{"type":"Range1d","id":"9533d9b6e4a1856840db36f878de366b"},"y_range":{"type":"Range1d","id":"c76ea06afea1688b5bd3716d7b198863"},"left":[{"type":"LinearAxis","id":"5aa02519dbca5c08c44724785adc9f15"}],"below":[{"type":"LinearAxis","id":"f2ab309bf3d3bff12a91ea134acce5b0"}],"right":[],"above":[],"renderers":[{"type":"LinearAxis","id":"f2ab309bf3d3bff12a91ea134acce5b0"},{"type":"LinearAxis","id":"5aa02519dbca5c08c44724785adc9f15"}],"tools":[{"type":"PanTool","id":"87da4c0aebebecd678ab67efff4ba9b2"},{"type":"WheelZoomTool","id":"dd4f0b71295a3732384b5ebc1d312a40"},{"type":"PreviewSaveTool","id":"6c1a68be223b5b74be31938a286fb114"}],"tool_events":{"type":"ToolEvents","id":"93d78041b4b17fed72c831069c62b0a8"},"extra_y_ranges":{},"extra_x_ranges":{},"tags":[],"doc":null,"min_border_left":4,"min_border_right":4,"min_border_top":4,"min_border_bottom":4,"lod_threshold":null,"map_options":{"lat":40.7331,"lng":-73.9735,"zoom":12,"map_type":"hybrid"}}},{"type":"PanTool","id":"87da4c0aebebecd678ab67efff4ba9b2","attributes":{"id":"87da4c0aebebecd678ab67efff4ba9b2","tags":[],"doc":null,"plot":{"type":"GMapPlot","id":"6c8d69120b9d12b04fe59b085b539ee9"},"dimensions":["width","height"]}},{"type":"ToolEvents","id":"93d78041b4b17fed72c831069c62b0a8","attributes":{"id":"93d78041b4b17fed72c831069c62b0a8","tags":[],"doc":null},"geometries":[]},{"type":"WheelZoomTool","id":"dd4f0b71295a3732384b5ebc1d312a40","attributes":{"id":"dd4f0b71295a3732384b5ebc1d312a40","tags":[],"doc":null,"plot":{"type":"GMapPlot","id":"6c8d69120b9d12b04fe59b085b539ee9"},"dimensions":["width","height"]}},{"type":"PreviewSaveTool","id":"6c1a68be223b5b74be31938a286fb114","attributes":{"id":"6c1a68be223b5b74be31938a286fb114","tags":[],"doc":null,"plot":{"type":"GMapPlot","id":"6c8d69120b9d12b04fe59b085b539ee9"}}},{"type":"Range1d","id":"9533d9b6e4a1856840db36f878de366b","attributes":{"id":"9533d9b6e4a1856840db36f878de366b","tags":[],"doc":null,"start":-82.003,"end":48.7625}},{"type":"Range1d","id":"c76ea06afea1688b5bd3716d7b198863","attributes":{"id":"c76ea06afea1688b5bd3716d7b198863","tags":[],"doc":null,"start":-82.003,"end":48.7625}},{"type":"LinearAxis","id":"f2ab309bf3d3bff12a91ea134acce5b0","attributes":{"id":"f2ab309bf3d3bff12a91ea134acce5b0","tags":[],"doc":null,"plot":{"type":"GMapPlot","id":"6c8d69120b9d12b04fe59b085b539ee9"},"axis_label":"","formatter":{"type":"BasicTickFormatter","id":"94bf18c41bdecd20824ec5ee4872bef9"},"ticker":{"type":"BasicTicker","id":"4b95ca6d3afbb2126aa96f8a68746dbd"},"visible":false}},{"type":"BasicTickFormatter","id":"94bf18c41bdecd20824ec5ee4872bef9","attributes":{"id":"94bf18c41bdecd20824ec5ee4872bef9","tags":[],"doc":null}},{"type":"BasicTicker","id":"4b95ca6d3afbb2126aa96f8a68746dbd","attributes":{"id":"4b95ca6d3afbb2126aa96f8a68746dbd","tags":[],"doc":null,"num_minor_ticks":5}},{"type":"LinearAxis","id":"5aa02519dbca5c08c44724785adc9f15","attributes":{"id":"5aa02519dbca5c08c44724785adc9f15","tags":[],"doc":null,"plot":{"type":"GMapPlot","id":"6c8d69120b9d12b04fe59b085b539ee9"},"axis_label":"","formatter":{"type":"BasicTickFormatter","id":"eabef825d265e76f354636a5c8da18bc"},"ticker":{"type":"BasicTicker","id":"08fbcf5077bd61c1e5afdd4f20573d9c"},"visible":false}},{"type":"BasicTickFormatter","id":"eabef825d265e76f354636a5c8da18bc","attributes":{"id":"eabef825d265e76f354636a5c8da18bc","tags":[],"doc":null}},{"type":"BasicTicker","id":"08fbcf5077bd61c1e5afdd4f20573d9c","attributes":{"id":"08fbcf5077bd61c1e5afdd4f20573d9c","tags":[],"doc":null,"num_minor_ticks":5}}]}}}');
var refkey = Object.keys(docs_json)[0]
var refs = docs_json[refkey].roots.references
function traverseObject(obj) {
for(var key in obj) {
if(obj[key].constructor === Object) {
traverseObject(obj[key]);
} else if(obj[key].constructor === Array) {
for (var i = 0; i < obj[key].length; i++) {
if(obj[key][i] === null)
obj[key][i] = NaN;
};
}
};
}
for(var i = 0; i < refs.length; i++) {
if(refs[i].type === "ColumnDataSource")
traverseObject(refs[i].attributes.data);
};
var render_items = [{
"docid": docid,
"elementid": elementid,
"modelid": modelid
}];
Bokeh.set_log_level('info');
Bokeh.embed.embed_items(docs_json, render_items);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment