☰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

Using dropdown to select legend.location

Community Support
Dave_King
Dave_King

I am attempting to use a dropdown to control legend location with errors on the js_link portion of the following code.

menu = [('Top Right', 'top_right'),('Top Left', 'top_left'), ('Top Center','top_center'),('Bottom  
    Right','bottom_right'),('Bottom Center','bottom_center'),('Bottom Left','bottom_left'),('Center 
    Left','center_left'),('Center Right','center_right'),('Center','center')]
Drop1 = Dropdown(label = 'Legend Position', menu = menu)
Drop1.js_link('value', tps.legend.location,"type")

I have tried variation to the js_link code such as:

    Drop1.js_link('type', tps.legend.location,"value")
    Drop1.js_link('value', tps.legend, 'location')
    Drop1.js_link(tps.legend, 'location',  attr_selector=0)
    Drop1.js_link(tps.legend, 'location')
    Drop1.js_link(tps.legend, 'value')

Thanks for any advice!

⌁   Link to post
Bryan
Bryan

To be honest I can’t recall anyone ever asking about moving a legend location after plot initialization before, and I am not aware that there are any tests that exercise this usage pattern. I think it’s reasonably likely that moving a legend post-initialization is just not presently supported. cc @mateusz in case he has any knowledge to the contrary. Otherwise I think it would be appropriate to open a GitHub Issue to request support for this in a future release.

⌁   Link to post

End of archived discussion · Replies are disabled