bokeh服务器更新斧头比例 [英] bokeh server update axe scale

查看:54
本文介绍了bokeh服务器更新斧头比例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用bokeh小部件更改y轴比例时,什么也没发生.但是,更新x范围确实可以.

When I try to change the y axis scale with a bokeh widget, nothing happens. Updating the x range however, does work.

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.

In the update function, changing the x range does work. For updating the y scale, I already tried to change the Formatter to LogTickFormatter.

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

Is it possible to update the scale to log scale and back? Or do I have to reload the entire plot?

推荐答案

是否可以将刻度更新为对数刻度并返回?

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

我想说,当前不支持动态更改图的比例.比例尺实际上只能在初始化时配置.如果需要更改比例,我会切换到该图的其他版本.

I would say that dynamically changing a plot's scale is not currently supported. Scales are really only configurable at initialization time. If you need to change scale I would switch to a different version of the plot.

也就是说,在 Slider 动作(与某些按钮或切换按钮相对)上改变比例似乎也很奇怪.

That said, it seems also strange to have the scale change on a Slider movement (as opposed to some button or toggle, say).

这篇关于bokeh服务器更新斧头比例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆