问题
Is it possible to define different heights for individual figures in a Bokeh gridplot
layout (bokeh==1.0.4
)?
For example, I have three figures with three different heights:
p1 = figure(
name="fig1",
width=500, height=500,
)
p2 = figure(
name="fig2",
width=500, height=1000,
)
p1 = figure(
name="fig3",
width=500, height=100,
)
I then place the figures into a gridplot
and add the root to curdoc()
:
grid = gridplot(
children = [p1,p2,p3],
ncols=1,
sizing_mode='stretch_both',
)
curdoc().add_root(grid)
However, when I render the Bokeh document (using the Bokeh server), the height of each row is the same, scaled to fill the available space in the containing div.
If I use sizing_mode='scale_width'
the figure heights are recognized and used. Why are the heights ignored for sizing_mode='stretch_both'
?
Note that this behavior is the same if I use layout()
instead of gridplot()
.
来源:https://stackoverflow.com/questions/55079873/bokeh-gridplot-define-different-heights-for-figures-with-sizing-mode-stretch-b