Skip to content

Instantly share code, notes, and snippets.

@jtr13
Created February 11, 2017 10:38
Show Gist options
  • Save jtr13/aaaa7191e7d6e93d57df4255ff8904a6 to your computer and use it in GitHub Desktop.
Save jtr13/aaaa7191e7d6e93d57df4255ff8904a6 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='707652978490e51cb2302cbd15369343' class='plotdiv'></div>
<div>
<script type='text/javascript'>
Bokeh.$(function() {
var modelid = 'd277e24edb30d5e5db99155481173823';
var elementid = '707652978490e51cb2302cbd15369343';
var docid = 'ba0906404a61a608600e2920bfe88048';
var docs_json = {"ba0906404a61a608600e2920bfe88048":{"version":"0.12.2","title":"Bokeh Figure","roots":{"root_ids":["d277e24edb30d5e5db99155481173823"],"references":[{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","attributes":{"id":"d277e24edb30d5e5db99155481173823","plot_width":500,"plot_height":500,"sizing_mode":"scale_both","x_range":{"type":"Range1d","id":"2675175a61cbc14badac22bed1c0fbf7"},"y_range":{"type":"Range1d","id":"8bf32a21d49b0c798f9612d38174cb16"},"left":[{"type":"LinearAxis","id":"0e0c71e24aea48c431ec484497ba194e"}],"below":[{"type":"LinearAxis","id":"a9a8a996950c6bf46138df9004823360"}],"right":[],"above":[],"renderers":[{"type":"BoxAnnotation","id":"deb88f94c928d4c73ce5a7aec1e04cd7"},{"type":"GlyphRenderer","id":"309e7cb6d6ff9bb184b1ad431e585147"},{"type":"LinearAxis","id":"a9a8a996950c6bf46138df9004823360"},{"type":"Grid","id":"d27a615a1cbe93bbed1afcd5a762e138"},{"type":"LinearAxis","id":"0e0c71e24aea48c431ec484497ba194e"},{"type":"Grid","id":"27b0887c1fc0101f305483e7ac7a6e7c"}],"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":"5bb0130027098a6559b99e89a3ead016"},"tool_events":{"type":"ToolEvents","id":"dd1f6377da1e57881f589cd83005d6e5"}},"subtype":"Figure"},{"type":"Toolbar","id":"5bb0130027098a6559b99e89a3ead016","attributes":{"id":"5bb0130027098a6559b99e89a3ead016","tags":[],"active_drag":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"type":"PanTool","id":"94e8fede2bfff950803a93745e1a3f62"},{"type":"WheelZoomTool","id":"47a12650752c6ac96fcfeacc0aa985aa"},{"type":"BoxZoomTool","id":"ee0e4cabeaf3d1453b218b4b5f31f807"},{"type":"ResetTool","id":"c8e97e1da505b12b69ed67b36559ee7e"},{"type":"SaveTool","id":"6d36621f1da9d27f3d083cba18f93b13"},{"type":"HelpTool","id":"cb832f9fe74a56f1e6c777eee549fcd5"}],"logo":null}},{"type":"PanTool","id":"94e8fede2bfff950803a93745e1a3f62","attributes":{"id":"94e8fede2bfff950803a93745e1a3f62","tags":[],"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"},"dimensions":["width","height"]}},{"type":"ToolEvents","id":"dd1f6377da1e57881f589cd83005d6e5","attributes":{"id":"dd1f6377da1e57881f589cd83005d6e5","tags":[]},"geometries":[]},{"type":"WheelZoomTool","id":"47a12650752c6ac96fcfeacc0aa985aa","attributes":{"id":"47a12650752c6ac96fcfeacc0aa985aa","tags":[],"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"},"dimensions":["width","height"]}},{"type":"BoxAnnotation","id":"deb88f94c928d4c73ce5a7aec1e04cd7","attributes":{"id":"deb88f94c928d4c73ce5a7aec1e04cd7","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":"ee0e4cabeaf3d1453b218b4b5f31f807","attributes":{"id":"ee0e4cabeaf3d1453b218b4b5f31f807","tags":[],"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"},"overlay":{"type":"BoxAnnotation","id":"deb88f94c928d4c73ce5a7aec1e04cd7"}}},{"type":"ResetTool","id":"c8e97e1da505b12b69ed67b36559ee7e","attributes":{"id":"c8e97e1da505b12b69ed67b36559ee7e","tags":[],"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"}}},{"type":"SaveTool","id":"6d36621f1da9d27f3d083cba18f93b13","attributes":{"id":"6d36621f1da9d27f3d083cba18f93b13","tags":[],"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"}}},{"type":"HelpTool","id":"cb832f9fe74a56f1e6c777eee549fcd5","attributes":{"id":"cb832f9fe74a56f1e6c777eee549fcd5","tags":[],"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"},"redirect":"http://hafen.github.io/rbokeh","help_tooltip":"Click to learn more about rbokeh."}},{"type":"ColumnDataSource","id":"ca1945c34b790a7b2f3d5ecc9882b0ed","attributes":{"id":"ca1945c34b790a7b2f3d5ecc9882b0ed","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":"99e3d5d5bdcf20f7d0b78be44ec68019","attributes":{"id":"99e3d5d5bdcf20f7d0b78be44ec68019","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":"37a3bfbeb2771b3108c0e8d11f5a957f","attributes":{"id":"37a3bfbeb2771b3108c0e8d11f5a957f","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":"e2d9beaf7beaefc0f36e70c3dee81861","attributes":{"id":"e2d9beaf7beaefc0f36e70c3dee81861","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":"309e7cb6d6ff9bb184b1ad431e585147","attributes":{"id":"309e7cb6d6ff9bb184b1ad431e585147","tags":[],"selection_glyph":null,"nonselection_glyph":{"type":"Circle","id":"37a3bfbeb2771b3108c0e8d11f5a957f"},"hover_glyph":{"type":"Circle","id":"e2d9beaf7beaefc0f36e70c3dee81861"},"name":null,"data_source":{"type":"ColumnDataSource","id":"ca1945c34b790a7b2f3d5ecc9882b0ed"},"glyph":{"type":"Circle","id":"99e3d5d5bdcf20f7d0b78be44ec68019"}}},{"type":"Range1d","id":"2675175a61cbc14badac22bed1c0fbf7","attributes":{"id":"2675175a61cbc14badac22bed1c0fbf7","tags":[],"start":0.37,"end":10.63}},{"type":"Range1d","id":"8bf32a21d49b0c798f9612d38174cb16","attributes":{"id":"8bf32a21d49b0c798f9612d38174cb16","tags":[],"start":0.37,"end":10.63}},{"type":"LinearAxis","id":"a9a8a996950c6bf46138df9004823360","attributes":{"id":"a9a8a996950c6bf46138df9004823360","tags":[],"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"},"axis_label":"index","formatter":{"type":"BasicTickFormatter","id":"3ae2038eef4fcbf73e2f64df27fef464"},"ticker":{"type":"BasicTicker","id":"eeea0c775b56b480c59257be4bc04899"},"visible":true,"axis_label_text_font_size":"12pt"}},{"type":"BasicTickFormatter","id":"3ae2038eef4fcbf73e2f64df27fef464","attributes":{"id":"3ae2038eef4fcbf73e2f64df27fef464","tags":[]}},{"type":"BasicTicker","id":"eeea0c775b56b480c59257be4bc04899","attributes":{"id":"eeea0c775b56b480c59257be4bc04899","tags":[],"num_minor_ticks":5}},{"type":"Grid","id":"d27a615a1cbe93bbed1afcd5a762e138","attributes":{"id":"d27a615a1cbe93bbed1afcd5a762e138","tags":[],"dimension":0,"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"},"ticker":{"type":"BasicTicker","id":"eeea0c775b56b480c59257be4bc04899"}}},{"type":"LinearAxis","id":"0e0c71e24aea48c431ec484497ba194e","attributes":{"id":"0e0c71e24aea48c431ec484497ba194e","tags":[],"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"},"axis_label":"1:10","formatter":{"type":"BasicTickFormatter","id":"06653c1d91b66ddfe1786ceb29243960"},"ticker":{"type":"BasicTicker","id":"21fe0dbd98046eb773a1ae911e5e7c2d"},"visible":true,"axis_label_text_font_size":"12pt"}},{"type":"BasicTickFormatter","id":"06653c1d91b66ddfe1786ceb29243960","attributes":{"id":"06653c1d91b66ddfe1786ceb29243960","tags":[]}},{"type":"BasicTicker","id":"21fe0dbd98046eb773a1ae911e5e7c2d","attributes":{"id":"21fe0dbd98046eb773a1ae911e5e7c2d","tags":[],"num_minor_ticks":5}},{"type":"Grid","id":"27b0887c1fc0101f305483e7ac7a6e7c","attributes":{"id":"27b0887c1fc0101f305483e7ac7a6e7c","tags":[],"dimension":1,"plot":{"type":"Plot","id":"d277e24edb30d5e5db99155481173823","subtype":"Figure"},"ticker":{"type":"BasicTicker","id":"21fe0dbd98046eb773a1ae911e5e7c2d"}}}]}}};
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