Bokeh3.0.3 layout issue in sizing_mode

Hello all, I copy the below code from the documentation and run it. I found some issue when trying sizing_mode with layout, which the same code will works well in Bokeh 2.4.3.


from bokeh.layouts import row
from bokeh.plotting import figure, show

x = list(range(11))

y0 = x

y1 = [10 - i for i in x]

y2 = [abs(i - 5) for i in x]

create three plots

s1 = figure(width=250, height=250, background_fill_color=“#fafafa”)

s1.circle(x, y0, size=12, color=“#53777a”, alpha=0.8)

s2 = figure(width=250, height=250, background_fill_color=“#fafafa”)

s2.triangle(x, y1, size=12, color=“#c02942”, alpha=0.8)

s3 = figure(width=250, height=250, background_fill_color=“#fafafa”)

s3.square(x, y2, size=12, color=“#d95b43”, alpha=0.8)

put the results in a row and show

show(row(s1, s2, s3, sizing_mode=‘scale_both’))

@RajonDawn With some small fixes to the quotation marks used in the given code,it works perfectly fine for me. Could you provide some more context to the issue you’re facing?

1 Like

@RajonDawn please edit your post to use code formatting so that the code is intelligible (either with the </> icon on the editing toolbar, or triple backtick ``` fences around the code blocks)

from bokeh.layouts import row
from bokeh.plotting import figure, show

x = list(range(11))
y0 = x
y1 = [10 - i for i in x]
y2 = [abs(i - 5) for i in x]
s1 = figure(width=250, height=250, background_fill_color="#fafafa")
s1.circle(x, y0, size=12, color="#53777a", alpha=0.8)
s2 = figure(width=250, height=250, background_fill_color="#fafafa")
s2.triangle(x, y1, size=12, color="#c02942", alpha=0.8)
s3 = figure(width=250, height=250, background_fill_color="#fafafa")
s3.square(x, y2, size=12, color="#d95b43", alpha=0.8)

show(row(s1, s2, s3, sizing_mode="scale_both"))

Hi, Bryan. I have posted the code above, sorry again for the previous code format error.

Hi, Chinmay. Thanks for your reply.
What puzzles me is that it shows the ‘sizing_mode’ doesn’t work well in Bokeh 3.0.3. And I wanna which version of bokeh are you using? Thanks.

FYI the latest version is 3.1

Thank you for your information, and I have updated the version of bokeh to 3.1.0, but it shows sizing_mode dosen’t, meanwhile the same code will works correctly in 2.4.3. Thanks.

cc @mateusz for comment. Is it necessary to add a style for an enclosing container?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.