I want to make a gridplot with an inner toolbar and my defined tools, but I encounter multiple issues. The MRE below shows that inner toolbar option set to figure is not working and save/copy/fullscreen tools are not as my defined tools but as default ones. Is it possible to fix these issues? Thanks.
from bokeh.plotting import figure, show, gridplot, output_notebook
from bokeh.models import ColumnDataSource
from bokeh.models.tools import Toolbar, WheelZoomTool, FullscreenTool, CopyTool, SaveTool
output_notebook()
wheel_zoom_tool = WheelZoomTool(description='This is a wheel zoom tool', icon='maximize')
fullscreen_tool = FullscreenTool(description='This is a fullscreen tool', icon='maximize')
copy_tool = CopyTool(description='This is a copy tool', icon='maximize')
save_tool = SaveTool(description='This is a save tool', icon='maximize')
p = figure(
tools=[wheel_zoom_tool, fullscreen_tool, copy_tool, save_tool],
toolbar_inner=True,
)
p.line(x=[1, 2, 3], y=[1, 2, 3], color='red')
p2 = figure(tools='')
p2.line(x=[1, 2, 3], y=[2, 3, 4], color='blue')
show(gridplot(
children=[[p2], [p]],
merge_tools=True,
toolbar_location='right',
# toolbar_options={'tools': [wheel_zoom_tool, fullscreen_tool, copy_tool, save_tool]},
))
In addition, I took a look at the code here https://docs.bokeh.org/en/latest/_modules/bokeh/layouts.html#gridplot
and I noticed some things:
- toolbar_inner option provided to figure doesn’t work (toolbar_inner is not available as an option for gridplot)
- toolbar_options provided to gridplot does not use tools option
SaveTool
,CopyTool
,ExamineTool
andFullscreenTool
tools have special treatment in themerge
function