散景服务器更新斧刻度

bokeh server update axe scale

当我尝试使用散景小部件更改 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()

在更新函数中,更改 x 范围确实有效。 为了更新 y 刻度,我已经尝试将 Formatter 更改为 LogTickFormatter。

是否可以将刻度更新为对数刻度并返回?还是我必须重新加载整个情节?

Is it possible to update the scale to log scale and back?

我会说目前不支持动态更改绘图的比例。比例实际上只能在初始化时配置。如果您需要更改比例,我会切换到不同版本的绘图。

也就是说,在 Slider 移动(而不是某些按钮或开关,例如)上改变比例似乎也很奇怪。