Specify location on categorical axis for BoxAnnotation

Hi,

Hi,

I would like to place a BoxAnnotation on a figure with a categorical axis,

but can’t figure out how to specify the exact location on the axis.

Any help is very much appreciated.

The BoxAnnotation in the picture was placed with help of a numerical axis location.

Screenshot 2018-11-22 at 13.29.42.png

p_normal = figure(y_range=scales, x_range=[25,110], plot_width=w, plot_height=h, toolbar_location=None, title=‘Normal’)

for scoring_variable in scored_variables[1:]:

normal_and_patho_curves = make_ridge(scoring_variable, source_data, x)

p_normal.patch(‘x’, ‘y_normal’, alpha=0.3, line_color=‘black’, source=normal_and_patho_curves, color=‘lightsteelblue’)

p_normal.text(27, y=dodge(‘text’, 0.8, range=p_normal.y_range), text=‘text’, source=ColumnDataSource(data=dict(text=scored_variables[1:])), **text_props)

p_normal.add_layout(BoxAnnotation(top=[‘Lacunes’))

``

BoxAnnotation expects a single coordinate (most annotation aren’t vectorized). It should work when you drop the list.

Mateusz

···

On Thu, Nov 22, 2018 at 1:33 PM landge [email protected] wrote:

ValueError: expected an element of either Auto or NumberSpec(String, Dict(Enum('expr', 'field', 'value', 'transform'), Either(String, Instance(Transform), Instance(Expression), Float)), Float), got ['Lacunes']

``

Thanks!!

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e554fb73-bd4e-43d8-b4bb-4f6a53c83325%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.