Private
Public Access
1
0

beautified pies

This commit is contained in:
Sander Roosendaal
2020-05-10 11:00:32 +02:00
parent 69f50afd3a
commit 98b45d910e

View File

@@ -231,25 +231,32 @@ def interactive_hr_piechart(df,rower,title):
size=350
TOOLS = 'save'
TOOLS = 'save,hover'
z = figure(title="HR "+title, x_range=(-1,1), y_range=(-1,1), width=size, height=size,
tools=TOOLS,
percts = 100.*(source_ends-source_starts)/(2*pi)
data = {}
data['zone'] = source_legends
data['value'] = percts
data['angle'] = data['value']/data['value'].sum() * 2*pi
data['color'] = colors
data['percentage'] = pd.Series(['{x:4.1f}%'.format(x=x) for x in percts])
z = figure(title="HR "+title, x_range=(-0.5,1), plot_height=350,
tools=TOOLS,toolbar_location=None,tooltips="@zone: @percentage",
)
for start, end , legend, color in zip(source_starts, source_ends, source_legends,
colors[0:len(source_starts)]):
z.wedge(x=0, y=0, radius=1, start_angle=start, end_angle=end, color=color, legend=legend)
z.wedge(x=0,y=1, radius=0.4,
start_angle=cumsum('angle',include_zero=True), end_angle=cumsum('angle'),
line_color='white',fill_color='color',source=data,legend='zone')
z.toolbar_location = 'right'
z.legend.location = 'top_right'
#z.legend.visible = False
z.axis.axis_label = None
z.axis.visible = False
z.xgrid.grid_line_color = None
z.ygrid.grid_line_color = None
z.grid.grid_line_color = None
z.outline_line_color = None
z.toolbar_location = 'right'
return components(z)