[[在此处输入图片描述] [1]我正在使用bokeh在美国地图上显示婴儿的名字信息。现在,我绘制了地图,我想使用悬停显示婴儿的名字。但我无法更改悬停中的连接。我能怎么做?我的文件名为df_latlon
这是我的代码:
from bokeh.models import HoverTool
from bokeh.plotting import figure, output_file, show, ColumnDataSource
from bokeh.sampledata import us_states
us_states = us_states.data.copy()
state_xs = [us_states[code]["lons"] for code in us_states]
state_ys = [us_states[code]["lats"] for code in us_states]
name=df_latlon["Name"]
T = "pan,wheel_zoom,reset,hover,save"
p = figure(title="Top 1 name of every state form 1910 to 2014", tools=T,
toolbar_location="left", plot_width=3000, plot_height=1300)
p.patches(state_xs, state_ys, fill_alpha=0.3,
line_color="blue", line_width=1.5)
x = df_latlon["lon"]
y = df_latlon["lat"]
source = ColumnDataSource(data=dict(
name=df_latlon["Name"],
gender=df_latlon["Gender"]
))
hover = HoverTool(tooltips=[("Name", "@name"),("Gender","@gender")])
output_file("statenametop1.html")
show(p)
https://i.stack.imgur.com/ZIMT8.png这是我的文件的屏幕截图
p.add_tools(hover)