Legend Outside Plot Area: Issue

I am replicating the outside legend example and find that when trying to change the orientation to horizontal and below, the legend is not responsive and does not allow for overflow text to wrap around. This occurs to long text in the legend. Is there a workaround for this or a need to specify some other attribute to allow for the legend to be responsive like the plot and wrap the text inside the legend container?

bokeh 12.4 Python 3.5

import numpy as np

from bokeh.models import Legend

from bokeh.plotting import figure, show, output_file

x = np.linspace(0, 4*np.pi, 100)

y = np.sin(x)


p = figure(toolbar_location=“above”)

r0 = p.circle(x, y)

r1 = p.line(x, y)

r2 = p.line(x, 2*y, line_dash=[4, 4], line_color=“orange”, line_width=2)

r3 = p.square(x, 3*y, fill_color=None, line_color=“green”)

r4 = p.line(x, 3*y, line_color=“green”)

r5 = p.line(x, 4*y, line_color=“pink”)

r6 = p.line(x, 5*y, line_color=“blue”)

legend = Legend(items=[

(“Very long text Legend Item 1 : sin(x)” , [r0, r1]),

(“very long text Legend Item 2: 2*sin(x)” , [r2]),

(“very long text Legend Item 3: 3*sin(x)” , [r3, r4]),

(“very long text Legend Item 3: 3*sin(x)” , [r5]),

(“very long text Legend Item 3: 3*sin(x)” , [r6])

], location=(0, -10), orientation=“horizontal”, glyph_height = 200)

p.add_layout(legend, ‘below’)


Any thoughts?