Appologies.
I’m running Bokeh 3.1.0
from bokeh.plotting import figure, show
from bokeh.layouts import layout
_width = 600
sm = "stretch_width"
p = figure(title="Test", width=_width, height=100,
sizing_mode=sm)
p2 = figure(title="Test2", width=_width, height=100,
sizing_mode=sm)
data = [0, 1, 2, 3]
data2 = [3, 2, 1, 0]
d = Div(text='This is the side text')
p.line(list(range(4)), data)
p2.line(list(range(4)), data2)
show(layout([p, d], [p2, d]))
With ‘sm’ set as in this code, both plots are reduced to essentially zero width. When ‘sm’ is None, they plot as you would expect.
While preparing this example, I noticed that for a single plot ‘show(p)’, the stretch seemed to work correctly. Given that I need more than one row, I reorganized to remove the layout() method:
from bokeh.plotting import figure, show
from bokeh.layouts import layout, row, column
from bokeh.models import Div
_width = 600
sm = None
sm = "stretch_width"
p = figure(title="Test", width=_width, height=100,
sizing_mode=sm)
p2 = figure(title="Test2", width=_width, height=100,
sizing_mode=sm)
data = [0, 1, 2, 3]
data2 = [3, 2, 1, 0]
d = Div(text='This is the side text')
p.line(list(range(4)), data)
p2.line(list(range(4)), data2)
l = column(row(p, d), row(p2, d))
show(l)
Unfortunately, I got the same result as my previous attempt.
I’m certain I’m just missing something fundamental, but I can’t quite find it.