Skip to content

Instantly share code, notes, and snippets.

@ruoyu0088
Created June 22, 2017 22:26
Show Gist options
  • Save ruoyu0088/bde6d0996b24cf878747d8644d56469f to your computer and use it in GitHub Desktop.
Save ruoyu0088/bde6d0996b24cf878747d8644d56469f to your computer and use it in GitHub Desktop.
from bokeh.plotting import figure, show
from bokeh.models import ColumnDataSource
from bokeh.models import HoverTool
data = ColumnDataSource(data=dict(x0=[1, 2, 3], y0=[1, 2, 3], x1=[1.2, 2.4, 3.1],
y1=[1.2, 2.5, 3.7], text=["a", "b", "c"]))
hover = HoverTool(tooltips=[
("desc", "@text"),
])
p = figure(plot_width=400, plot_height=400, tools=[hover])
p.segment(x0="x0", y0="y0", x1="x1", y1="y1", color="#F4A582", source=data)
show(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment