【发布时间】:2021-08-07 01:20:55
【问题描述】:
使用来自https://github.com/bokeh/bokeh/blob/branch-2.4/examples/plotting/file/sizing_mode.py的示例
我添加了第二个情节。大小调整模式似乎只适用于第一个情节。 有没有一个技巧可以让两个图都响应调整大小?谢谢
from bokeh.core.enums import SizingMode
from bokeh.layouts import column
from bokeh.models import Select
from bokeh.plotting import figure, output_file, show
from bokeh.sampledata.iris import flowers as df
colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
colors = [colormap[x] for x in df.species]
plot = figure(sizing_mode="fixed")
plot.circle(df.petal_length, df.petal_width, color=colors, alpha=0.2, size=10)
plot2 = figure(sizing_mode="fixed")
plot2.circle(df.petal_length, df.petal_width, color=colors, alpha=0.2, size=10)
select = Select(title="Sizing mode", value="fixed", options=list(SizingMode), width=300)
select.js_link('value', plot, 'sizing_mode')
layout = column(select, plot, plot2)
layout.sizing_mode = "stretch_both" # set separately to avoid also setting children
output_file("sizing_mode.html", title="sizing_mode.py example")
show(layout)
【问题讨论】: