-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqfp.py
More file actions
27 lines (26 loc) · 691 Bytes
/
qfp.py
File metadata and controls
27 lines (26 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from bokeh.plotting import ColumnDataSource, figure, output_notebook, show
from bokeh.models import HoverTool
from collections import OrderedDict
def plot(x, y, labels=None, **kwargs):
TOOLS="pan,wheel_zoom,box_zoom,reset,hover"
p = figure(tools=TOOLS, **kwargs)
try:
l = list(labels)
except:
l = list(x)
source = ColumnDataSource(
data=dict(
x = x,
y = y,
l = l,
)
)
p.scatter(x, y, size=10, source=source)
hover = p.select(dict(type=HoverTool))
hover.tooltips = OrderedDict([
("Label", "@l"),
("X", "@x"),
("Y", "@y"),
])
output_notebook()
show(p)