beautified pies
This commit is contained in:
@@ -231,25 +231,32 @@ def interactive_hr_piechart(df,rower,title):
|
|||||||
|
|
||||||
|
|
||||||
size=350
|
size=350
|
||||||
TOOLS = 'save'
|
TOOLS = 'save,hover'
|
||||||
|
|
||||||
z = figure(title="HR "+title, x_range=(-1,1), y_range=(-1,1), width=size, height=size,
|
percts = 100.*(source_ends-source_starts)/(2*pi)
|
||||||
tools=TOOLS,
|
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,
|
z.wedge(x=0,y=1, radius=0.4,
|
||||||
colors[0:len(source_starts)]):
|
start_angle=cumsum('angle',include_zero=True), end_angle=cumsum('angle'),
|
||||||
z.wedge(x=0, y=0, radius=1, start_angle=start, end_angle=end, color=color, legend=legend)
|
line_color='white',fill_color='color',source=data,legend='zone')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
z.toolbar_location = 'right'
|
z.axis.axis_label = None
|
||||||
z.legend.location = 'top_right'
|
|
||||||
#z.legend.visible = False
|
|
||||||
z.axis.visible = False
|
z.axis.visible = False
|
||||||
z.xgrid.grid_line_color = None
|
z.grid.grid_line_color = None
|
||||||
z.ygrid.grid_line_color = None
|
|
||||||
z.outline_line_color = None
|
z.outline_line_color = None
|
||||||
|
z.toolbar_location = 'right'
|
||||||
|
|
||||||
return components(z)
|
return components(z)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user