2017-10-01 10 views
0

목표 : 파이썬에서 Bokeh 툴팁의 배경색을 변경하는 방법을 배우십시오. 다음은 Bokeh python의 툴팁 색상을 변경하는 올바른 방법은 무엇입니까?

은 나를 위해 작동 코드입니다,하지만 난 (현재이 툴팁/호버 만 흰색 배경을 생산) 툴팁 내에서 색상을 조정할 수없는 것 :

# 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

아마도 과잉을 거기 쉬운 방법입니다하지만 당신은 [사용자 정의 HTML 템플릿 (https://bokeh.pydata.org/en/latest/docs/user_guide/tools.html을 사용할 수 있습니다 # custom-tooltip)을 사용하십시오. – Alex

답변

0

알렉스 I 바탕으로 성공적으로 솔루션을 발견

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>