【发布时间】:2022-01-02 21:53:08
【问题描述】:
我希望在打开 html 页面时将悬停工具栏的平移工具设置为关闭。 默认情况下,该工具处于打开状态。如何默认关闭? Figure - Trying to "deactivate" pan tool by default
使用共享 x 轴(网格图)时似乎会出现问题。
命令p.toolbar.active_drag = None 没有帮助;平移工具保持活动状态。
任何想法如何解决这个问题?
示例
from bokeh.plotting import ColumnDataSource, figure, output_file, show,output_notebook,reset_output
from bokeh.models import HoverTool,Grid
from bokeh.layouts import gridplot
import datetime
reset_output()
output_notebook()
tools = 'pan,wheel_zoom,xbox_select,reset'
source = ColumnDataSource(data=dict(time=[2231231233123, 1431231233123, 1731231233123],y=[2, 5, 3],))
source2 = ColumnDataSource(data=dict(time=[1231231233123, 1431231233123, 1731231233123],x=[1, 2, 3],))
# Figure 1:
p = figure(width=400, height=200, x_axis_type="datetime",tools=tools)
p.circle('time', 'y', size=20, source=source)
p.toolbar.active_drag = None
# Figure 2:
p2 = figure(x_range=p.x_range,width=400,height=200,x_axis_type="datetime",tools=tools)
p2.circle('time', 'x', size=20, source=source2)
p2.toolbar.active_drag = None
grid = gridplot([p, p2], ncols=1)
show (grid)
举例说明
【问题讨论】:
-
我在 GitHub #11839 上打开了一个问题。让我们看看会发生什么。
标签: python hover bokeh toolbar