当我尝试用bokeh小部件更改y轴比例时,什么都没有发生。
但是,更新x范围确实有效。
def make_document(doc):
df = some_pandas_dataframe()
x = range(len(df))
plot = figure(sizing_mode='scale_both')
scatters = list()
for l in labels:
scatters.append(plot.step(x=x, y=df[l].sort_values(), alpha=0.2))
x_range_slider = RangeSlider(start=0, end=int(math.ceil(df.shape[0]/1000) * 1000), value=(0, df.shape[0]), step=1, title='Wer hat es geschafft? Der Joshua')
p_layout = layout(plot, x_range_slider)
def update(attr, old, new):
p_layout.children[0].x_range.start = x_range_slider.value[0]
p_layout.children[0].x_range.end = x_range_slider.value[1]
p_layout.children[0].y_scale = LogScale()
p_layout.children[0].y_scale.update()
for wdg in [x_range_slider]:
wdg.on_change('value', update)
doc.title = "Secret"
doc.add_root(p_layout)
apps = {'/': Application(FunctionHandler(make_document))}
server = Server(apps, port=5005, allow_websocket_origin=['*'])
server.start()
在update函数中,更改x范围确实有效。
为了更新y刻度,我已经尝试将格式化程序更改为LogTickFormatter。
是否可以将刻度更新为日志刻度并返回?还是我必须重新加载整个情节?