我使用annular_wedge
字形在散景中创建了以下圆环图。我创建了一个工具提示,显示百分比和&适用于每个楔形的类别,但总是包含额外的category : ???
和percents:1
为什么会出现,我该如何删除它?
这是指向用于生成情节的笔记本的链接:link
# 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 :(得分:0)
我通过在函数调用中直接设置这些值来解决问题:
p.annular_wedge(x=0, y=0, inner_radius=0.5, outer_radius=1, ... )