Skip to content

Instantly share code, notes, and snippets.

@draperjames
Last active January 11, 2017 15:32
Show Gist options
  • Save draperjames/7e49c5ef903dec2132e6390bedba3c1e to your computer and use it in GitHub Desktop.
Save draperjames/7e49c5ef903dec2132e6390bedba3c1e to your computer and use it in GitHub Desktop.
easy bokeh display in jupyter notebook
%env BOKEH_RESOURCES=inline ipython notebook
from bokeh.io import show, output_notebook
from bokeh.plotting import ColumnDataSource, figure
from bokeh.models import HoverTool, Range1d
output_notebook()
fig = figure(tools=[HoverTool(tooltips=[("html", "@html{safe}")])])
fig.quad(left="left", top="top", bottom="bottom", right="right",
source=ColumnDataSource({"left": [1,3], "bottom": [1,3],
"right": [2,4], "top": [2,4],
"html":["<b>I'm bold</b>", "some text"]}))
show(fig)
@draperjames
Copy link
Author

The caveat is that ToolTips will not render @html{safe} correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment