Toggle between linear and log scale in bokeh

主宰稳场 提交于 2019-12-02 05:44:38

One potential solution is the put both linear and log plots into Tabs like:

from bokeh.plotting import figure, show
from bokeh.models.widgets import Tabs, Panel

panels = []

for axis_type in ["linear", "log"]:
    fig = figure(x_axis_type=axis_type, y_axis_type=axis_type)
    fig.scatter(x=[1,10,100,1000], y=[1,10,100,1000])

    panel = Panel(child=fig, title=axis_type)
    panels.append(panel)

tabs = Tabs(tabs=panels)

show(tabs)

Alternatively, you wire up a bokeh.models.widgets.Button with a CustomJS callback that changes the plot ranges, but the above seems a little easier to me.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!