我正在構建一個web應用程序,它將顯示圖像作爲數據分析管道的一部分。爲此,我需要動態更改散景中對象Figure
的寬度和高度。動態改變散景的形狀圖
使用以下代碼,Figure
的形狀已更改,但更改僅在調整瀏覽器窗口大小後才生效,即使瀏覽器窗口調整大小非常小。
import bokeh.plotting
import bokeh.models
import bokeh.layouts
# set up the interface
fig1 = bokeh.plotting.figure()
button = bokeh.models.Button(label='scramble')
# define a callback and connect it
def callback():
fig1.width = int(fig1.width * .8)
button.on_click(callback)
# add everything to the document
bokeh.plotting.curdoc().add_root(bokeh.layouts.column(button, fig1))
是否有一些我需要運行的更新方法?我已經閱讀了「下一次刻度線回調」,但我不明白這是否相關。發生
上述行爲都與Firefox和鉻我的GNOME系統上。
上面的代碼以「背景虛化服務」 –