Skip to content

[BUG] PanTool can't be deactivated in grid plot #11839

@mosc9575

Description

@mosc9575

Software versions

Python version : 3.9.7 | packaged by conda-forge | (default, Sep 23 2021, 07:28:37)
IPython version : 7.28.0
Tornado version : 6.1
Bokeh version : 2.4.2
BokehJS static path : /opt/conda/envs/development/lib/python3.9/site-packages/bokeh/server/static
node.js version : v15.14.0
npm version : 7.7.6
Operating system : Linux-5.10.0-8-amd64-x86_64-with-glibc2.31

Browser name and version

Chrome, Version 96.0.4664.45

Jupyter notebook / Jupyter Lab version

No response

Expected behavior

I expect to disable tools like the PanTool for grids in a similar way like for single figures official documentation.

Observed behavior

It is not possuble to deactivate a tool in a grid plot. The toolbar of the grid plot is of type ProxyToolbar with two toolbars of type Toolbar.

There is a question on StackOverflow about this behavior.

Example code

from bokeh.plotting import ColumnDataSource, figure, show, output_notebook
from bokeh.layouts import gridplot

source = ColumnDataSource(data=dict(x=[1, 2, 3],y=[2, 5, 3],))                         

def get_figure():
    p = figure(width=400, height=200,tools='pan')
    p.circle('x', 'y', size=20, source=source)
    p.toolbar.active_drag = None
    return p


grid = gridplot([get_figure() for i in range(2)], ncols=1)
grid.children[0].toolbar.toolbars[0].active_drag = None
show(grid)


show(get_figure())

Stack traceback or browser console output

No response

Screenshots

This is the output of an single figure, working like explained in the documentation. The tool is deactivated, like expected.
Singel

This is the output for a grid. The tool is not deactivated.
Grid

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions