Skip to content

Instantly share code, notes, and snippets.

@mwhitaker mwhitaker/README.md
Created Feb 18, 2016

Embed
What would you like to do?
test
figure() %>% ly_points(1:10)
<!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="5fe021868ece13cfbbbd3bd849d665b7" class="plotdiv"></div>
<script type="text/javascript">
Bokeh.$(function() {
var modelid = "422a5ec3307069b55d061ffd2e8c7eca";
var elementid = "5fe021868ece13cfbbbd3bd849d665b7";
var docid = "cb5ee5f3afb67fca2424325491cb9cff";
var docs_json = JSON.parse('{"cb5ee5f3afb67fca2424325491cb9cff":{"version":"0.11.0","title":"Bokeh Figure","roots":{"root_ids":["422a5ec3307069b55d061ffd2e8c7eca"],"references":[{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","attributes":{"title":null,"id":"422a5ec3307069b55d061ffd2e8c7eca","plot_width":470,"plot_height":474,"x_range":{"type":"Range1d","id":"87a97c024a03142140b09dd3e3f5a0ab"},"y_range":{"type":"Range1d","id":"660ec2bbb718c089dec95c6e64b04a02"},"left":[{"type":"LinearAxis","id":"e5b54bf000636f50f41de0b324de28bd"}],"below":[{"type":"LinearAxis","id":"8a8681ae8da6949b021d771b6e201fd3"}],"right":[],"above":[],"renderers":[{"type":"GlyphRenderer","id":"97cbfb6a8ffdd77b14369d519e0d63bf"},{"type":"LinearAxis","id":"8a8681ae8da6949b021d771b6e201fd3"},{"type":"Grid","id":"7026d1374a0d2e9c4c85f28f2c04783e"},{"type":"LinearAxis","id":"e5b54bf000636f50f41de0b324de28bd"},{"type":"Grid","id":"e57ea9699d7614ec27a6df9546a39049"}],"tools":[{"type":"PanTool","id":"a2b8e6ae865f670c87b7cf131c4034e7"},{"type":"WheelZoomTool","id":"9e41a85e76859ef92c9d1b43b651eecf"},{"type":"BoxZoomTool","id":"c085fd8faf850219974761aef38b6746"},{"type":"ResizeTool","id":"37dd0a48be85e5126d1e465727ed0b22"},{"type":"ResetTool","id":"d41aa403a30dcfca3dee74f8e5e9ad50"},{"type":"PreviewSaveTool","id":"f2a847e7789f72cae4206d81e3b2639c"},{"type":"HelpTool","id":"450a0eb718cb0a9014aec4801751bbbe"}],"tool_events":{"type":"ToolEvents","id":"257a724cbfe2419b4a202370219b7cf7"},"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},"subtype":"Figure"},{"type":"PanTool","id":"a2b8e6ae865f670c87b7cf131c4034e7","attributes":{"id":"a2b8e6ae865f670c87b7cf131c4034e7","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"},"dimensions":["width","height"]}},{"type":"ToolEvents","id":"257a724cbfe2419b4a202370219b7cf7","attributes":{"id":"257a724cbfe2419b4a202370219b7cf7","tags":[],"doc":null},"geometries":[]},{"type":"WheelZoomTool","id":"9e41a85e76859ef92c9d1b43b651eecf","attributes":{"id":"9e41a85e76859ef92c9d1b43b651eecf","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"},"dimensions":["width","height"]}},{"type":"BoxZoomTool","id":"c085fd8faf850219974761aef38b6746","attributes":{"id":"c085fd8faf850219974761aef38b6746","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"}}},{"type":"ResizeTool","id":"37dd0a48be85e5126d1e465727ed0b22","attributes":{"id":"37dd0a48be85e5126d1e465727ed0b22","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"}}},{"type":"ResetTool","id":"d41aa403a30dcfca3dee74f8e5e9ad50","attributes":{"id":"d41aa403a30dcfca3dee74f8e5e9ad50","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"}}},{"type":"PreviewSaveTool","id":"f2a847e7789f72cae4206d81e3b2639c","attributes":{"id":"f2a847e7789f72cae4206d81e3b2639c","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"}}},{"type":"HelpTool","id":"450a0eb718cb0a9014aec4801751bbbe","attributes":{"id":"450a0eb718cb0a9014aec4801751bbbe","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"},"redirect":["http://hafen.github.io/rbokeh"],"help_tooltip":["Click to learn more about rbokeh."]}},{"type":"ColumnDataSource","id":"de8693de68a810c5d5faa1f9ba0dc04c","attributes":{"id":"de8693de68a810c5d5faa1f9ba0dc04c","tags":[],"doc":null,"column_names":["x","y"],"selected":[],"discrete_ranges":{},"cont_ranges":{},"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":"84c6a347104786c42bda0933cdc91d89","attributes":{"id":"84c6a347104786c42bda0933cdc91d89","tags":[],"doc":null,"size":{"units":"screen","value":10},"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":"5a3ce28c25f64ba2812165ae8d05e0e9","attributes":{"id":"5a3ce28c25f64ba2812165ae8d05e0e9","tags":[],"doc":null,"size":{"units":"screen","value":10},"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":"GlyphRenderer","id":"97cbfb6a8ffdd77b14369d519e0d63bf","attributes":{"id":"97cbfb6a8ffdd77b14369d519e0d63bf","tags":[],"doc":null,"selection_glyph":null,"nonselection_glyph":{"type":"Circle","id":"5a3ce28c25f64ba2812165ae8d05e0e9"},"server_data_source":null,"name":null,"data_source":{"type":"ColumnDataSource","id":"de8693de68a810c5d5faa1f9ba0dc04c"},"glyph":{"type":"Circle","id":"84c6a347104786c42bda0933cdc91d89"}}},{"type":"Range1d","id":"87a97c024a03142140b09dd3e3f5a0ab","attributes":{"id":"87a97c024a03142140b09dd3e3f5a0ab","tags":[],"doc":null,"start":0.37,"end":10.63}},{"type":"Range1d","id":"660ec2bbb718c089dec95c6e64b04a02","attributes":{"id":"660ec2bbb718c089dec95c6e64b04a02","tags":[],"doc":null,"start":0.37,"end":10.63}},{"type":"LinearAxis","id":"8a8681ae8da6949b021d771b6e201fd3","attributes":{"id":"8a8681ae8da6949b021d771b6e201fd3","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"},"axis_label":"index","formatter":{"type":"BasicTickFormatter","id":"e7d8858c2a5b8216ad95e661307bd0a6"},"ticker":{"type":"BasicTicker","id":"b7f476a231c3d9ad305ffb4e45f4c6b9"},"visible":true,"axis_label_text_font_size":"12pt"}},{"type":"BasicTickFormatter","id":"e7d8858c2a5b8216ad95e661307bd0a6","attributes":{"id":"e7d8858c2a5b8216ad95e661307bd0a6","tags":[],"doc":null}},{"type":"BasicTicker","id":"b7f476a231c3d9ad305ffb4e45f4c6b9","attributes":{"id":"b7f476a231c3d9ad305ffb4e45f4c6b9","tags":[],"doc":null,"num_minor_ticks":5}},{"type":"Grid","id":"7026d1374a0d2e9c4c85f28f2c04783e","attributes":{"id":"7026d1374a0d2e9c4c85f28f2c04783e","tags":[],"doc":null,"dimension":0,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"},"ticker":{"type":"BasicTicker","id":"b7f476a231c3d9ad305ffb4e45f4c6b9"}}},{"type":"LinearAxis","id":"e5b54bf000636f50f41de0b324de28bd","attributes":{"id":"e5b54bf000636f50f41de0b324de28bd","tags":[],"doc":null,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"},"axis_label":"1:10","formatter":{"type":"BasicTickFormatter","id":"1db52a938d1ce1bc00a4efa075f7e57e"},"ticker":{"type":"BasicTicker","id":"88100310334fc950bf3a40532750ac0d"},"visible":true,"axis_label_text_font_size":"12pt"}},{"type":"BasicTickFormatter","id":"1db52a938d1ce1bc00a4efa075f7e57e","attributes":{"id":"1db52a938d1ce1bc00a4efa075f7e57e","tags":[],"doc":null}},{"type":"BasicTicker","id":"88100310334fc950bf3a40532750ac0d","attributes":{"id":"88100310334fc950bf3a40532750ac0d","tags":[],"doc":null,"num_minor_ticks":5}},{"type":"Grid","id":"e57ea9699d7614ec27a6df9546a39049","attributes":{"id":"e57ea9699d7614ec27a6df9546a39049","tags":[],"doc":null,"dimension":1,"plot":{"type":"Plot","id":"422a5ec3307069b55d061ffd2e8c7eca","subtype":"Figure"},"ticker":{"type":"BasicTicker","id":"88100310334fc950bf3a40532750ac0d"}}}]}}}');
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.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
You can’t perform that action at this time.