我是Bokeh的新手,正在尝试学习如何使用悬停工具。情节显示不是显示我想要的内容,而是显示??? (请参见下文)
import numpy as np
import pandas as pd
from bokeh.plotting import figure, output_file,show
from bokeh.io import show, output_notebook
from bokeh.models import ColumnDataSource, HoverTool
from bokeh.sampledata.iris import flowers
colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
colors = [colormap[x] for x in flowers['species']]
TOOLTIPS = [
("index", "$index"),
("(x,y)", "($x, $y)"),
("species", "@species"),
]
p = figure(title = "Iris Morphology",
tools="pan,lasso_select,box_select,hover",
tooltips=TOOLTIPS)
p.xaxis.axis_label = 'Petal Length'
p.yaxis.axis_label = 'Petal Width'
p.circle(flowers["petal_length"], flowers["petal_width"],
color=colors, fill_alpha=0.2, size=10)
# Set to output the plot in the notebook
output_notebook()
# Show the plot
show(p)
我已经研究了解决方案(见下文),但找不到答案。
In Bokeh, how do I add tooltips to a Timeseries chart (hover tool)?
Bokeh hover tooltip not displaying all data - Ipython notebook
谢谢!