Python 3.x 条形图工具提示上缺少值
我对bokeh条形图有问题。 这是我的密码:Python 3.x 条形图工具提示上缺少值,python-3.x,jupyter-notebook,bokeh,Python 3.x,Jupyter Notebook,Bokeh,我对bokeh条形图有问题。 这是我的密码: from bkcharts import Bar from bokeh.models import FactorRange # Make Bokeh Push push output to Jupyter Notebook. from bokeh.io import push_notebook, show, output_notebook from bokeh.resources import INLINE output_notebook(reso
from bkcharts import Bar
from bokeh.models import FactorRange
# Make Bokeh Push push output to Jupyter Notebook.
from bokeh.io import push_notebook, show, output_notebook
from bokeh.resources import INLINE
output_notebook(resources=INLINE)
from bokeh.models import HoverTool
data = {
'name' : [chan['name'] for chan in full_channels_info],
'members' : [chan['num_members'] for chan in full_channels_info]
}
hover = HoverTool(tooltips=[
("Channel", "@name"),
("Users", "@members"),
])
chart = Bar(data, values='members', label='name',
title="Channels population", plot_width=1000, xlabel="Channel", ylabel="Members",
legend=None, tools=[hover])
show(chart)
问题在于,当我将鼠标悬停在其中一个栏上时,工具提示如下所示:
问题在于,在
HoverTool()
中,您应该参考@height
,而不是@members
hover = HoverTool(tooltips=[
("Channel", "@name"),
("Users", "@height"),
])