RadioGroup horizontal orientation is still vertical

I may be misunderstanding the orientation property of the RadioGroup. I have set a RadioGroup with the horizontal orientation but they are still vertically disposed.

radio_group = RadioGroup(labels=["Cluster 1", "Cluster 2", "Cluster 3"], 
                                  active=0, background='white', 
                                  orientation='horizontal')

(…)
doc.add_root(column(radio_group, plot))

How can I have those 3 radio buttons in a single row instead of 3 rows, with the plot remaining below them as shown?

Hi @Wall.E

I do not think it is a misunderstanding on your part. If you look bokeh Issue 11374 on GitHub, you can see some historical context from the developers. Highlighting the important statement here for reference …

“Orientation is not implemented on button groups at all, it’s just bad design decisions that lead to it inheriting orientation property from Widget model. Though it shouldn’t be too hard to make it work.”

The main relevant issue on bokeh GitHub appears to be the following one, which was recently addressed and merged into the branch for 2.4 release.

The discussion on these issues is all in the context of button-groups, and looking at the bokeh docs, RadioGroup, which you specifically ask about, derives from a slightly different parent, i.e. bokeh.models.widgets.groups.Group, whereas RadioButtonGroup derives from bokeh.models.widgets.groups.ButtonGroup.

With that caveat, hopefully it is also addressed in the 2.4 release. If not, you might need to follow up with a feature request on GitHub.

2 Likes