我试图在Bokeh,python中创建圆环图。
我使用Bokeh文档示例代码:
from bokeh.charts import Donut, show, output_file
from bokeh.charts.utils import df_from_json
from bokeh.sampledata.olympics2014 import data
import pandas as pd
# utilize utility to make it easy to get json/dict data converted to a dataframe
df = df_from_json(data)
# filter by countries with at least one medal and sort by total medals
df = df[df['total'] > 8]
df = df.sort_values(by="total", ascending=False)
df = pd.melt(df, id_vars=['abbr'],
value_vars=['bronze', 'silver', 'gold'],
value_name='medal_count', var_name='medal')
# original example
d = Donut(df, label=['abbr', 'medal'], values='medal_count',
text_font_size='8pt', hover_text='medal_count')
output_file("donut.html", title="donut.py example")
show(d)
但我得到的是没有悬停工具的图表。
如何将悬停工具添加到此类图表中?
提前谢谢。