本文整理汇总了Python中bokeh.models.HoverTool.point_policy方法的典型用法代码示例。如果您正苦于以下问题:Python HoverTool.point_policy方法的具体用法?Python HoverTool.point_policy怎么用?Python HoverTool.point_policy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bokeh.models.HoverTool
的用法示例。
在下文中一共展示了HoverTool.point_policy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: nbytes_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def nbytes_plot(**kwargs):
data = {'name': [], 'left': [], 'right': [], 'center': [], 'color': [],
'percent': [], 'MB': [], 'text': []}
source = ColumnDataSource(data)
fig = figure(title='Memory Use', tools='', toolbar_location=None, **kwargs)
fig.quad(source=source, top=1, bottom=0,
left='left', right='right', color='color', alpha=0.8)
fig.text(source=source, x='center', y=0.5, text='text',
text_baseline='middle', text_align='center')
fig.grid.grid_line_color = None
fig.grid.grid_line_color = None
fig.axis.visible = None
fig.outline_line_color = None
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Name:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Percent:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@percent</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">MB:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@MB</span>
</div>
"""
hover.point_policy = 'follow_mouse'
return source, fig
示例2: nbytes_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def nbytes_plot(**kwargs):
data = {"name": [], "left": [], "right": [], "center": [], "color": [], "percent": [], "MB": [], "text": []}
source = ColumnDataSource(data)
fig = figure(title="Memory Use", tools="", toolbar_location=None, id="bk-nbytes-plot", **kwargs)
fig.quad(source=source, top=1, bottom=0, left="left", right="right", color="color", alpha=1)
fig.grid.grid_line_color = None
fig.grid.grid_line_color = None
fig.axis.visible = None
fig.outline_line_color = None
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Name:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Percent:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@percent</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">MB:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@MB</span>
</div>
"""
hover.point_policy = "follow_mouse"
return source, fig
示例3: __init__
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def __init__(self, scheduler, **kwargs):
with log_errors():
self.scheduler = scheduler
self.source = ColumnDataSource({'occupancy': [0, 0],
'worker': ['a', 'b'],
'x': [0.0, 0.1],
'y': [1, 2],
'ms': [1, 2]})
fig = figure(title='Occupancy', tools='resize', id='bk-occupancy-plot',
x_axis_type='datetime', **kwargs)
fig.rect(source=self.source, x='x', width='ms', y='y', height=1,
color='blue')
fig.xaxis.minor_tick_line_alpha = 0
fig.yaxis.visible = False
fig.ygrid.visible = False
# fig.xaxis[0].formatter = NumeralTickFormatter(format='0.0s')
fig.x_range.start = 0
hover = HoverTool()
hover.tooltips = "@worker : @occupancy s"
hover.point_policy = 'follow_mouse'
fig.add_tools(hover)
self.root = fig
示例4: __init__
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def __init__(self, **kwargs):
data = self.processing_update({'processing': {}, 'ncores': {}})
self.source = ColumnDataSource(data)
x_range = Range1d(-1, 1)
fig = figure(
title='Processing and Pending', tools='resize',
x_range=x_range, id='bk-processing-stacks-plot', **kwargs)
fig.quad(source=self.source, left=0, right='right', color=Spectral9[0],
top='top', bottom='bottom')
fig.xaxis.minor_tick_line_alpha = 0
fig.yaxis.visible = False
fig.ygrid.visible = False
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Host:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Processing:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@processing</span>
</div>
"""
hover.point_policy = 'follow_mouse'
self.root = fig
示例5: data_usage_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def data_usage_plot(df):
def create_data_source(df):
return ColumnDataSource(data=dict(filesystem=df['filesystem'],total_size=df['total_size'],used=df['used'],available=df['available'],use_percent=df['use_percent'],mounted=['mounted'],submittime=[x.strftime("%Y-%m-%d") for x in df['submittime']]))
hover = HoverTool(names=['points'])
TOOLS = [BoxZoomTool(),PanTool(),ResetTool(),WheelZoomTool(),hover]
Colors = ['red','navy','olive','firebrick','lightskyblue','yellowgreen','lightcoral','yellow', 'green','blue','gold']
# Change percents to format bokeh can use
fp_list = []
for row in df['use_percent']:
fp_list.append(float(row.replace('%','')))
df['f_percent'] = fp_list
# Begin Plotting
x_max = datetime.now()
p = figure(height=500, width=1000, x_axis_type="datetime", x_range=((x_max-timedelta(14)),x_max), y_axis_label='Percent Full', tools=TOOLS, title='Data Usage by Filesystem')
# Points with hover info
p.scatter(x=df['submittime'], y=df['f_percent'], name='points', source=create_data_source(df), color='black', size=6)
df = df.groupby(by = ['filesystem'])
# Connecting lines
count = 0
for filesystem, group in df:
count += 1
p.line(x=group['submittime'] ,y=group['f_percent'], color=Colors[count], legend=str(filesystem), line_width=3)
# Formating
p.legend.orientation = "top_left"
hover.point_policy = "follow_mouse"
hover.tooltips = [("Filesystem", "@filesystem"),("Size","@total_size"),("Available","@available"),("Percent Used","@use_percent"),("Time","@submittime")]
return p
示例6: task_stream_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def task_stream_plot(sizing_mode="scale_width", **kwargs):
data = {
"start": [],
"duration": [],
"key": [],
"name": [],
"color": [],
"worker": [],
"y": [],
"worker_thread": [],
"alpha": [],
}
source = ColumnDataSource(data)
x_range = DataRange1d(range_padding=0)
fig = figure(
x_axis_type="datetime",
title="Task stream",
tools="xwheel_zoom,xpan,reset,box_zoom",
toolbar_location="above",
sizing_mode=sizing_mode,
x_range=x_range,
id="bk-task-stream-plot",
**kwargs
)
fig.rect(
x="start",
y="y",
width="duration",
height=0.8,
fill_color="color",
line_color="color",
line_alpha=0.6,
alpha="alpha",
line_width=3,
source=source,
)
fig.xaxis.axis_label = "Time"
fig.yaxis.axis_label = "Worker Core"
fig.ygrid.grid_line_alpha = 0.4
fig.xgrid.grid_line_color = None
fig.min_border_right = 35
fig.yaxis[0].ticker.num_minor_ticks = 0
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 12px; font-weight: bold;">@name:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@duration</span>
<span style="font-size: 10px;">ms</span>
</div>
"""
hover.point_policy = "follow_mouse"
return source, fig
示例7: progress_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def progress_plot(height=300, width=800, **kwargs):
from ..diagnostics.progress_stream import progress_quads
data = progress_quads({'all': {}, 'in_memory': {},
'erred': {}, 'released': {}})
source = ColumnDataSource(data)
fig = figure(width=width, height=height, tools=['resize'],
responsive=True, **kwargs)
fig.quad(source=source, top='top', bottom='bottom',
left=0, right=1, color='#aaaaaa', alpha=0.2)
fig.quad(source=source, top='top', bottom='bottom',
left=0, right='released_right', color='#0000FF', alpha=0.4)
fig.quad(source=source, top='top', bottom='bottom',
left='released_right', right='in_memory_right',
color='#0000FF', alpha=0.8)
fig.quad(source=source, top='top', bottom='bottom',
left='erred_left', right=1,
color='#000000', alpha=0.3)
fig.text(source=source, text='fraction', y='center', x=-0.01,
text_align='right', text_baseline='middle')
fig.text(source=source, text='name', y='center', x=1.01,
text_align='left', text_baseline='middle')
fig.scatter(x=[-0.2, 1.4], y=[0, 5], alpha=0)
fig.xgrid.grid_line_color = None
fig.ygrid.grid_line_color = None
fig.axis.visible = None
fig.min_border_left = 0
fig.min_border_right = 10
fig.min_border_top = 0
fig.min_border_bottom = 0
fig.outline_line_color = None
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Name:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">All:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@all</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">In Memory:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@in_memory</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Erred:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@erred</span>
</div>
"""
hover.point_policy = 'follow_mouse'
return source, fig
示例8: worker_table_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def worker_table_plot(**kwargs):
""" Column data source and plot for host table """
with log_errors():
# names = ['host', 'cpu', 'memory_percent', 'memory', 'cores', 'processes',
# 'processing', 'latency', 'last-seen', 'disk-read', 'disk-write',
# 'network-send', 'network-recv']
names = ['processes', 'disk-read', 'cores', 'cpu', 'disk-write',
'memory', 'last-seen', 'memory_percent', 'host']
source = ColumnDataSource({k: [] for k in names})
columns = {name: TableColumn(field=name,
title=name.replace('_percent', ' %'))
for name in names}
cnames = ['host', 'cores', 'processes', 'memory', 'cpu', 'memory_percent']
formatters = {'cpu': NumberFormatter(format='0.0 %'),
'memory_percent': NumberFormatter(format='0.0 %'),
'memory': NumberFormatter(format='0 b'),
'latency': NumberFormatter(format='0.00000'),
'last-seen': NumberFormatter(format='0.000'),
'disk-read': NumberFormatter(format='0 b'),
'disk-write': NumberFormatter(format='0 b'),
'net-send': NumberFormatter(format='0 b'),
'net-recv': NumberFormatter(format='0 b')}
table = DataTable(source=source, columns=[columns[n] for n in cnames],
**kwargs)
for name in cnames:
if name in formatters:
table.columns[cnames.index(name)].formatter = formatters[name]
x_range = Range1d(0, 1)
y_range = Range1d(-.1, .1)
mem_plot = figure(title="Memory Usage (%)",
tools='box_select', height=90, width=600,
x_range=x_range, y_range=y_range, toolbar_location=None)
mem_plot.circle(source=source, x='memory_percent', y=0, size=10,
alpha=0.5)
mem_plot.yaxis.visible = False
mem_plot.xaxis.minor_tick_line_width = 0
mem_plot.ygrid.visible = False
mem_plot.xaxis.minor_tick_line_alpha = 0
hover = HoverTool()
mem_plot.add_tools(hover)
hover = mem_plot.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 10px; font-family: Monaco, monospace;">@host: </span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@memory_percent</span>
</div>
"""
hover.point_policy = 'follow_mouse'
return source, [mem_plot, table]
示例9: progress_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def progress_plot(**kwargs):
from ..diagnostics.progress_stream import progress_quads
data = progress_quads({'all': {}, 'in_memory': {},
'erred': {}, 'released': {}})
x_range = Range1d(-0.5, 1.5)
y_range = Range1d(5.1, -0.1)
source = ColumnDataSource(data)
fig = figure(tools='', toolbar_location=None, y_range=y_range, x_range=x_range, **kwargs)
fig.quad(source=source, top='top', bottom='bottom',
left=0, right=1, color='#aaaaaa', alpha=0.2)
fig.quad(source=source, top='top', bottom='bottom',
left=0, right='released_right', color=Spectral9[0], alpha=0.4)
fig.quad(source=source, top='top', bottom='bottom',
left='released_right', right='in_memory_right',
color=Spectral9[0], alpha=0.8)
fig.quad(source=source, top='top', bottom='bottom',
left='erred_left', right=1,
color='#000000', alpha=0.3)
fig.text(source=source, text='fraction', y='center', x=-0.01,
text_align='right', text_baseline='middle')
fig.text(source=source, text='name', y='center', x=1.01,
text_align='left', text_baseline='middle')
fig.xgrid.grid_line_color = None
fig.ygrid.grid_line_color = None
fig.axis.visible = None
fig.outline_line_color = None
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Name:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">All:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@all</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">In Memory:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@in_memory</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Erred:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@erred</span>
</div>
"""
hover.point_policy = 'follow_mouse'
return source, fig
示例10: _draw_contigCirclePlot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def _draw_contigCirclePlot(self):
hover = HoverTool(tooltips=[('Length', '@contigs')])
hover.point_policy = "follow_mouse"
plot = figure(x_axis_type=None, y_axis_type=None, tools=[hover], title='Contig lengths')
plot.annular_wedge(x=0, y=0, inner_radius=0.5, outer_radius=0.7,
start_angle='start', end_angle='stop',
color='colors', alpha=0.9, source=self.contig_dist_src)
plot.yaxis.axis_label_text_font_size = '14pt'
plot.xaxis.axis_label_text_font_size = '14pt'
plot.yaxis.major_label_text_font_size = '14pt'
plot.xaxis.major_label_text_font_size = '14pt'
plot.title.text_font_size = '16pt'
return plot
示例11: progress_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def progress_plot(**kwargs):
with log_errors():
from ..diagnostics.progress_stream import progress_quads
data = progress_quads({'all': {}, 'memory': {},
'erred': {}, 'released': {}})
y_range = Range1d(-8, 0)
source = ColumnDataSource(data)
fig = figure(tools='', toolbar_location=None, y_range=y_range, **kwargs)
fig.quad(source=source, top='top', bottom='bottom',
left='left', right='right', color='#aaaaaa', alpha=0.2)
fig.quad(source=source, top='top', bottom='bottom',
left='left', right='released-loc', color=Spectral9[0], alpha=0.4)
fig.quad(source=source, top='top', bottom='bottom',
left='released-loc', right='memory-loc', color=Spectral9[0], alpha=0.8)
fig.quad(source=source, top='top', bottom='bottom',
left='erred-loc', right='erred-loc', color='#000000', alpha=0.3)
fig.text(source=source, text='show-name', y='bottom', x='left',
x_offset=5, text_font_size='10pt')
fig.text(source=source, text='done', y='bottom', x='right', x_offset=-5,
text_align='right', text_font_size='10pt')
fig.xaxis.visible = False
fig.yaxis.visible = False
fig.grid.grid_line_alpha = 0
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Name:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">All:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@all</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Memory:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@memory</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Erred:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@erred</span>
</div>
"""
hover.point_policy = 'follow_mouse'
return source, fig
示例12: progress_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def progress_plot(**kwargs):
with log_errors():
from ..diagnostics.progress_stream import progress_quads
data = progress_quads({"all": {}, "memory": {}, "erred": {}, "released": {}})
y_range = Range1d(-8, 0)
source = ColumnDataSource(data)
fig = figure(tools="", toolbar_location=None, y_range=y_range, id="bk-progress-plot", **kwargs)
fig.quad(source=source, top="top", bottom="bottom", left="left", right="right", color="#aaaaaa", alpha=0.2)
fig.quad(source=source, top="top", bottom="bottom", left="left", right="released-loc", color="color", alpha=0.6)
fig.quad(
source=source, top="top", bottom="bottom", left="released-loc", right="memory-loc", color="color", alpha=1
)
fig.quad(
source=source, top="top", bottom="bottom", left="erred-loc", right="erred-loc", color="#000000", alpha=0.3
)
fig.text(source=source, text="show-name", y="bottom", x="left", x_offset=5, text_font_size="10pt")
fig.text(
source=source, text="done", y="bottom", x="right", x_offset=-5, text_align="right", text_font_size="10pt"
)
fig.xaxis.visible = False
fig.yaxis.visible = False
fig.grid.grid_line_alpha = 0
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Name:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">All:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@all</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Memory:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@memory</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Erred:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@erred</span>
</div>
"""
hover.point_policy = "follow_mouse"
return source, fig
示例13: task_stream_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def task_stream_plot(height=400, width=800, follow_interval=5000, **kwargs):
data = {'start': [], 'duration': [],
'key': [], 'name': [], 'color': [],
'worker': [], 'y': [], 'worker_thread': []}
source = ColumnDataSource(data)
if follow_interval:
x_range = DataRange1d(follow='end', follow_interval=follow_interval,
range_padding=0)
else:
x_range = None
fig = figure(width=width, height=height, x_axis_type='datetime',
tools=['xwheel_zoom', 'xpan', 'reset', 'resize', 'box_zoom'],
responsive=True, x_range=x_range, **kwargs)
fig.rect(x='start', width='duration',
y='y', height=0.9,
fill_color='color', line_color='gray', source=source)
if x_range:
fig.circle(x=[1, 2], y=[1, 2], alpha=0.0)
fig.xaxis.axis_label = 'Time'
fig.yaxis.axis_label = 'Worker Core'
fig.min_border_right = 10
fig.ygrid.grid_line_alpha = 0.4
fig.xgrid.grid_line_alpha = 0.0
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Key:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Duration:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@duration</span>
</div>
"""
hover.point_policy = 'follow_mouse'
return source, fig
示例14: task_stream_plot
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
def task_stream_plot(sizing_mode='scale_width', **kwargs):
data = {'start': [], 'duration': [],
'key': [], 'name': [], 'color': [],
'worker': [], 'y': [], 'worker_thread': [], 'alpha': []}
source = ColumnDataSource(data)
x_range = DataRange1d(range_padding=0)
fig = figure(
x_axis_type='datetime', title="Task stream",
tools='xwheel_zoom,xpan,reset,box_zoom', toolbar_location='above',
sizing_mode=sizing_mode, x_range=x_range, **kwargs
)
fig.rect(
x='start', y='y', width='duration', height=0.8,
fill_color='color', line_color='color', line_alpha=0.6, alpha='alpha',
line_width=3, source=source
)
fig.xaxis.axis_label = 'Time'
fig.yaxis.axis_label = 'Worker Core'
fig.ygrid.grid_line_alpha = 0.4
fig.xgrid.grid_line_color = None
fig.min_border_right = 35
fig.yaxis[0].ticker.num_minor_ticks = 0
hover = HoverTool()
fig.add_tools(hover)
hover = fig.select(HoverTool)
hover.tooltips = """
<div>
<span style="font-size: 14px; font-weight: bold;">Key:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@name</span>
</div>
<div>
<span style="font-size: 14px; font-weight: bold;">Duration:</span>
<span style="font-size: 10px; font-family: Monaco, monospace;">@duration</span>
</div>
"""
hover.point_policy = 'follow_mouse'
return source, fig
示例15: Circle
# 需要导入模块: from bokeh.models import HoverTool [as 别名]
# 或者: from bokeh.models.HoverTool import point_policy [as 别名]
color = loc_color,
rprice = price,
dis = distance,
addr = address,
restaurant = food,
cafe = cafes,
pub = pubs,
size = sqft,
)
)
circle = Circle(x = 'lon', y = 'lat', fill_color = 'color', size = 10, fill_alpha=0.6, line_color=None)
plot.add_glyph(source, circle)
# Hover
hover = HoverTool()
hover.point_policy = "follow_mouse"
hover.tooltips = [
("Address", "@addr"),
("Price per Room", "@rprice"),
("Distance to Campus", "@dis"),
("Food Quality", "@restaurant"),
("Number of cafes", "@cafe"),
("Number of pubs", "@pub"),
("Room size", "@size"),
]
tools = [PanTool(), WheelZoomTool(), hover]
plot.add_tools(*tools)
output_file("gmap_plot.html")
show(plot)