Pie and donut charts#
Glyphs#
Wedge#
The wedge() glyph method renders a filled wedge. It accepts radius,
start_angle, and end_angle to determine position. Additionally, the
direction property determines whether to render clockwise ("clock")
or anti-clockwise ("anticlock") between the start and end angles.
from bokeh.plotting import figure, show
p = figure(width=400, height=400)
p.wedge(x=[1, 2, 3], y=[1, 2, 3], radius=0.2, start_angle=0.4, end_angle=4.8,
color="firebrick", alpha=0.6, direction="clock")
show(p)
Annular wedge#
The annular_wedge() glyph method is similar to wedge() but leaves an inner
portion of the wedge hollow. It accepts an inner_radius and
outer_radius instead of just radius.
from bokeh.plotting import figure, show
p = figure(width=400, height=400)
p.annular_wedge(x=[1, 2, 3], y=[1, 2, 3], inner_radius=0.1, outer_radius=0.25,
start_angle=0.4, end_angle=4.8, color="green", alpha=0.6)
show(p)
Annulus#
Finally, the annulus() glyph method also accepts inner_radius and
outer_radius to produce hollow circles.
Pie chart#
Donut chart#
from bokeh.plotting import figure, show
p = figure(width=400, height=400)
p.annulus(x=[1, 2, 3], y=[1, 2, 3], inner_radius=0.1, outer_radius=0.25,
color="orange", alpha=0.6)
show(p)