Bokeh gridplot: define different heights for figures with sizing_mode='stretch_both'

北城以北 提交于 2019-12-11 00:42:25

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!