☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Annular wedge position in screen units

Community Supportbokeh
bkos
bkos

I want to make a small KPI card consisting of an annular wedge and a label. When plot stretched horizontally I would like them to stay in the same position. The label can be set using screen units, whereas the annular wedge cannot. The behavior is shown in the MRE by toggling the comment on the width_policy='max' on the figure. Can the feature of setting annular wedge x/y in screen units be implemented? Thanks.

from bokeh.plotting import figure, show, output_notebook
from bokeh.models import Label
output_notebook()

p = figure(
    width=300,
    height=70,
    min_width=300,
    # width_policy='max',
    min_border=8,
    x_range=(0, 100),
    y_range=(0, 10),
)

p.outline_line_color = 'cyan'
p.border_fill_color = 'cyan'
p.background_fill_color = 'cyan'
p.axis.visible = False
p.grid.visible = False

label = Label(
    x=60,
    y=15,
    x_units='screen',
    y_units='screen',
    text='70%',
    text_align='left',
    text_font_size='24px',
    border_line_color=None,
    background_fill_color=None,
)
p.add_layout(label)

p.annular_wedge(
    x=10,
    y=[5, 5],
    inner_radius=19,
    outer_radius=24,
    inner_radius_units='screen',
    outer_radius_units='screen',
    start_angle=1.5,
    end_angle=[1.501, 4],
    color='green',
    line_color=None,
    fill_color='green',
    alpha=[0.2, 1],
    direction='clock',
)

show(p)
⌁   Link to post

End of archived discussion · Replies are disabled