2015-04-08 28 views
2

我已經在散景中創建了以下圓環圖,使用annular_wedge字形。我創建了一個工具提示,顯示正常百分比&類別每個楔形,但總是包含一個額外的category : ???percents:1散景環形楔形工具提示:額外信息始終存在

爲什麼出現了,我怎麼能刪除嗎?

下面是用於生成情節筆記本的鏈接:link

enter image description here

# define starts/ends for wedges from percentages of a circle 
percents = [0, 0.14, 0.22, 0.40, 0.83, 0.99, 1.0] 
category = ['Extreme ', 'High ', 'Light ', 'Medium ', 'Not Classified', 'Very Light '] 
starts = [p*2*pi for p in percents[:-1]] 
ends = [p*2*pi for p in percents[1:]] 

# a color for each pie piece 
colors = brewer['Spectral'][len(percents)] 

# create source 
source = ColumnDataSource(
    data=dict(
     x=[0 for x in percents], 
     y=[0 for x in percents], 
     ymin = [0.5 for x in percents], 
     ymax = [1 for x in percents], 
     percents=percents, 
     category= category, 
     starts=starts, 
     colors=colors, 
     ends=ends, 
    ) 
) 

# create chart 
TOOLS = "hover" 
p = bk.figure(title='Chronic',title_text_font ='Roboto', title_text_font_size ='14pt', title_text_alpha =0.7, 
       x_range=(-1.1,1.1), y_range=(-1.1,1.1), width=250, height=250, tools=TOOLS) 

p.annular_wedge(x='x', y='y', inner_radius='ymin', outer_radius='ymax', direction="anticlock", 
       start_angle='starts', end_angle='ends', color='colors', source=source) 

hover = p.select(dict(type=HoverTool)) 
hover.tooltips = [ 
    ('category', '@category'), 
    ('percents','@percents') 
] 

# displays 
bk.show(p) 

回答

0

我通過函數調用直接設置這些值解決了這個問題:

p.annular_wedge(x=0, y=0, inner_radius=0.5, outer_radius=1, ...)