Skip to content

Instantly share code, notes, and snippets.

@stefvanbuuren
Created May 1, 2017 21:11
Show Gist options
  • Save stefvanbuuren/8a1df4ac40e79a40f379df302141f0ed to your computer and use it in GitHub Desktop.
Save stefvanbuuren/8a1df4ac40e79a40f379df302141f0ed to your computer and use it in GitHub Desktop.
test
license: none
height:
scrolling: no
border: yes
figure() %>% ly_points(1:10)
<!DOCTYPE html>
<html>
<head>
<script src='https://cdn.pydata.org/bokeh/release/bokeh-0.12.2.min.js'></script>
<link href='https://cdn.pydata.org/bokeh/release/bokeh-0.12.2.min.css' rel='stylesheet'>
</head>
<body>
<div class='bk-root' class='plotdiv' style=' width: 500px; height: 500px;'>
<div id='3699e5bff80b9c3f0c5a079b562fc0d0' class='plotdiv'></div>
<div>
<script type='text/javascript'>
Bokeh.$(function() {
var modelid = 'f70b5276a8381074b4f2cf6763e8cdb9';
var elementid = '3699e5bff80b9c3f0c5a079b562fc0d0';
var docid = '9dc5c071fba8da2bf05f160beeee5376';
var docs_json = {"9dc5c071fba8da2bf05f160beeee5376":{"version":"0.12.2","title":"Bokeh Figure","roots":{"root_ids":["f70b5276a8381074b4f2cf6763e8cdb9"],"references":[{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","attributes":{"id":"f70b5276a8381074b4f2cf6763e8cdb9","plot_width":500,"plot_height":500,"sizing_mode":"scale_both","x_range":{"type":"Range1d","id":"ed08fe86a006ce53e0518bebf483820a"},"y_range":{"type":"Range1d","id":"4b9c1fe499d279575b5c86af1d51aa44"},"left":[{"type":"LinearAxis","id":"be641d02c78f85ffd72c96c0ceb138a6"}],"below":[{"type":"LinearAxis","id":"53a0e679e99b433222569fd017069217"}],"right":[],"above":[],"renderers":[{"type":"BoxAnnotation","id":"6984dde4c9e4d15d5a56d8b4e54444c1"},{"type":"GlyphRenderer","id":"39abc8d4360268c789758626ac14e9ff"},{"type":"LinearAxis","id":"53a0e679e99b433222569fd017069217"},{"type":"Grid","id":"4165dfc6ab2c63e99ebedda8919d7722"},{"type":"LinearAxis","id":"be641d02c78f85ffd72c96c0ceb138a6"},{"type":"Grid","id":"d18bc5912812ecaf760ff5e0f72ed265"}],"extra_y_ranges":{},"extra_x_ranges":{},"tags":[],"min_border_left":4,"min_border_right":4,"min_border_top":4,"min_border_bottom":4,"lod_threshold":null,"toolbar":{"type":"Toolbar","id":"f67c0b8c21f7c2f62dc9785e2a38fec3"},"tool_events":{"type":"ToolEvents","id":"737a663818c858c914953e8311a7ea5a"}},"subtype":"Figure"},{"type":"Toolbar","id":"f67c0b8c21f7c2f62dc9785e2a38fec3","attributes":{"id":"f67c0b8c21f7c2f62dc9785e2a38fec3","tags":[],"active_drag":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"type":"PanTool","id":"06d70cd80722bad66bc0a46afd93c1dc"},{"type":"WheelZoomTool","id":"ea50c0a819fb4ebf8ccf1d2f7c15a7fb"},{"type":"BoxZoomTool","id":"cea98d58e01a0a560a306c15f6c8f054"},{"type":"ResetTool","id":"cea28dbbfb1f0a25ec6e7d47b0d695d8"},{"type":"SaveTool","id":"d38ba56af94a8ff5f34ff0f1e5f4353b"},{"type":"HelpTool","id":"f9fd1f3c325a39c272483dfd77e3f01e"}],"logo":null}},{"type":"PanTool","id":"06d70cd80722bad66bc0a46afd93c1dc","attributes":{"id":"06d70cd80722bad66bc0a46afd93c1dc","tags":[],"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"},"dimensions":["width","height"]}},{"type":"ToolEvents","id":"737a663818c858c914953e8311a7ea5a","attributes":{"id":"737a663818c858c914953e8311a7ea5a","tags":[]},"geometries":[]},{"type":"WheelZoomTool","id":"ea50c0a819fb4ebf8ccf1d2f7c15a7fb","attributes":{"id":"ea50c0a819fb4ebf8ccf1d2f7c15a7fb","tags":[],"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"},"dimensions":["width","height"]}},{"type":"BoxAnnotation","id":"6984dde4c9e4d15d5a56d8b4e54444c1","attributes":{"id":"6984dde4c9e4d15d5a56d8b4e54444c1","tags":[],"line_color":{"units":"data","value":"black"},"line_alpha":{"units":"data","value":1},"fill_color":{"units":"data","value":"lightgrey"},"fill_alpha":{"units":"data","value":0.5},"line_dash":[4,4],"line_width":{"units":"data","value":2},"level":"overlay","top_units":"screen","bottom_units":"screen","left_units":"screen","right_units":"screen","render_mode":"css"}},{"type":"BoxZoomTool","id":"cea98d58e01a0a560a306c15f6c8f054","attributes":{"id":"cea98d58e01a0a560a306c15f6c8f054","tags":[],"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"},"overlay":{"type":"BoxAnnotation","id":"6984dde4c9e4d15d5a56d8b4e54444c1"}}},{"type":"ResetTool","id":"cea28dbbfb1f0a25ec6e7d47b0d695d8","attributes":{"id":"cea28dbbfb1f0a25ec6e7d47b0d695d8","tags":[],"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"}}},{"type":"SaveTool","id":"d38ba56af94a8ff5f34ff0f1e5f4353b","attributes":{"id":"d38ba56af94a8ff5f34ff0f1e5f4353b","tags":[],"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"}}},{"type":"HelpTool","id":"f9fd1f3c325a39c272483dfd77e3f01e","attributes":{"id":"f9fd1f3c325a39c272483dfd77e3f01e","tags":[],"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"},"redirect":"http://hafen.github.io/rbokeh","help_tooltip":"Click to learn more about rbokeh."}},{"type":"ColumnDataSource","id":"277303f782015b376878126dc44c7d72","attributes":{"id":"277303f782015b376878126dc44c7d72","tags":[],"column_names":["x","y"],"selected":[],"data":{"x":[1,2,3,4,5,6,7,8,9,10],"y":[1,2,3,4,5,6,7,8,9,10]}}},{"type":"Circle","id":"065e911b55e151d175bb862ca320da2d","attributes":{"id":"065e911b55e151d175bb862ca320da2d","tags":[],"size":{"units":"screen","value":10},"visible":true,"line_color":{"units":"data","value":"#1F77B4"},"fill_color":{"units":"data","value":"#1F77B4"},"line_alpha":{"units":"data","value":1},"fill_alpha":{"units":"data","value":0.5},"x":{"units":"data","field":"x"},"y":{"units":"data","field":"y"}}},{"type":"Circle","id":"5664cbee13e375656c777b7935e9a223","attributes":{"id":"5664cbee13e375656c777b7935e9a223","tags":[],"size":{"units":"screen","value":10},"visible":true,"line_color":{"units":"data","value":"#e1e1e1"},"fill_color":{"units":"data","value":"#e1e1e1"},"line_alpha":{"units":"data","value":1},"fill_alpha":{"units":"data","value":0.5},"x":{"units":"data","field":"x"},"y":{"units":"data","field":"y"}}},{"type":"Circle","id":"6dfdb06d63cb00df773c1f870be79367","attributes":{"id":"6dfdb06d63cb00df773c1f870be79367","tags":[],"size":{"units":"screen","value":10},"visible":true,"line_color":{"units":"data","value":"#1F77B4"},"fill_color":{"units":"data","value":"#1F77B4"},"line_alpha":{"units":"data","value":1},"fill_alpha":{"units":"data","value":1},"x":{"units":"data","field":"x"},"y":{"units":"data","field":"y"}}},{"type":"GlyphRenderer","id":"39abc8d4360268c789758626ac14e9ff","attributes":{"id":"39abc8d4360268c789758626ac14e9ff","tags":[],"selection_glyph":null,"nonselection_glyph":{"type":"Circle","id":"5664cbee13e375656c777b7935e9a223"},"hover_glyph":{"type":"Circle","id":"6dfdb06d63cb00df773c1f870be79367"},"name":null,"data_source":{"type":"ColumnDataSource","id":"277303f782015b376878126dc44c7d72"},"glyph":{"type":"Circle","id":"065e911b55e151d175bb862ca320da2d"}}},{"type":"Range1d","id":"ed08fe86a006ce53e0518bebf483820a","attributes":{"id":"ed08fe86a006ce53e0518bebf483820a","tags":[],"start":0.37,"end":10.63}},{"type":"Range1d","id":"4b9c1fe499d279575b5c86af1d51aa44","attributes":{"id":"4b9c1fe499d279575b5c86af1d51aa44","tags":[],"start":0.37,"end":10.63}},{"type":"LinearAxis","id":"53a0e679e99b433222569fd017069217","attributes":{"id":"53a0e679e99b433222569fd017069217","tags":[],"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"},"axis_label":"index","formatter":{"type":"BasicTickFormatter","id":"c6d6df2768567e3f22059bdd7ec5c4e7"},"ticker":{"type":"BasicTicker","id":"26bc6c33dce61fae842fd5a69abc68e4"},"visible":true,"axis_label_text_font_size":"12pt"}},{"type":"BasicTickFormatter","id":"c6d6df2768567e3f22059bdd7ec5c4e7","attributes":{"id":"c6d6df2768567e3f22059bdd7ec5c4e7","tags":[]}},{"type":"BasicTicker","id":"26bc6c33dce61fae842fd5a69abc68e4","attributes":{"id":"26bc6c33dce61fae842fd5a69abc68e4","tags":[],"num_minor_ticks":5}},{"type":"Grid","id":"4165dfc6ab2c63e99ebedda8919d7722","attributes":{"id":"4165dfc6ab2c63e99ebedda8919d7722","tags":[],"dimension":0,"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"},"ticker":{"type":"BasicTicker","id":"26bc6c33dce61fae842fd5a69abc68e4"}}},{"type":"LinearAxis","id":"be641d02c78f85ffd72c96c0ceb138a6","attributes":{"id":"be641d02c78f85ffd72c96c0ceb138a6","tags":[],"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"},"axis_label":"1:10","formatter":{"type":"BasicTickFormatter","id":"6ea8415e3899d1df96e3eb338ed9a3fd"},"ticker":{"type":"BasicTicker","id":"d3b2118784d094a2e04947745955572d"},"visible":true,"axis_label_text_font_size":"12pt"}},{"type":"BasicTickFormatter","id":"6ea8415e3899d1df96e3eb338ed9a3fd","attributes":{"id":"6ea8415e3899d1df96e3eb338ed9a3fd","tags":[]}},{"type":"BasicTicker","id":"d3b2118784d094a2e04947745955572d","attributes":{"id":"d3b2118784d094a2e04947745955572d","tags":[],"num_minor_ticks":5}},{"type":"Grid","id":"d18bc5912812ecaf760ff5e0f72ed265","attributes":{"id":"d18bc5912812ecaf760ff5e0f72ed265","tags":[],"dimension":1,"plot":{"type":"Plot","id":"f70b5276a8381074b4f2cf6763e8cdb9","subtype":"Figure"},"ticker":{"type":"BasicTicker","id":"d3b2118784d094a2e04947745955572d"}}}]}}};
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