I’m working on a project using Bokeh 3.2.1 where I have a layout with multiple plots and widgets organized in multiple columns and rows. I would like all the plots to use as much space as they can while being scaled to maintain their aspect ratio whenever I resize the browser window, but haven’t managed to do so.
Based on the documentation, I thought sizing_mode = scale_both and/or aspect_ratio = 1.0 would do the trick, but apparently not.
I tried to create a minimal example below; please note that I use pyscript, so the code below can be saved as html which can be opened in a browser to test.
Basically, with the above, the aspect ratio of the plot is not maintained, the plot just stretches both horizontally and vertically.
When I set sizing_mode=“scale_width” for the plot instead, the aspect ratio is maintained if the parent column is higher than it is wide; however, when I resize the browser window such that the parent column is wider than it is high, then the aspect ratio is again not maintained and the plot uses as much width as possible whereas the height is being reduced.
The behavior I would expect is that, if the parent column is wider than it is high, the plot would be scaled such that the maximum height is being used and the width scaled such that the aspect ratio is maintained (i.e., the width will be scaled to match the height to maintain an aspect ratio of 1.0).
I hope I’m just missing something trivial!