在Bokeh python中更改工具提示颜色的正确方法是什么?

时间:2017-10-01 01:50:16

标签: python html visualization bokeh

目标:了解如何在Python中更改Bokeh工具提示的背景颜色。

下面是适合我的代码,但我似乎无法在工具提示中调整颜色(目前这只为工具提示/悬停生成白色背景):

# Sometimes Bokeh is to verbose
import warnings
warnings.filterwarnings('ignore')

# Develop a histogram
from bokeh.charts import Bar, output_file, show

# Information contained within the hoover
tooltips=[
    ('Age', '@Age'),
    ('Count', '@height{0,000}')
]


colormap = {'Age':'gray'}
colors = colormap

from bokeh.palettes import brewer
#palette = brewer["Blues"][3]

# Create chart
p = Bar(data, 'Age', values='Age', title="Hep-C Age",xlabel="Age", ylabel="Number of Observations",
        agg='count',
       tooltips=tooltips, legend=False,plot_width=600, plot_height=400, 
        tools="lasso_select,box_select,tap,box_zoom,reset,save", active_drag="lasso_select",
       toolbar_location="above",color="gray",title_text_font_size='14pt',title_text_color="gray")

1 个答案:

答案 0 :(得分:0)

基于Alex我成功找到了解决方案:

hover = HoverTool( tooltips="""

    <div style ="border-style: solid;border-width: 15px;background-color:black;">         
        <div>
            <span style="font-size: 12px; color: white;font-family:century gothic;">@height{0,000}</span>
            <span style="font-size: 12px; color: white;font-family:century gothic;"> Observations</span>
        </div>
    </div>