Skip to content

Commit

Permalink
Added options for toolbars on Layout and Grid plots (#2289)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored and jlstevens committed Feb 1, 2018
1 parent cc0db76 commit 46b1754
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions holoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ class GridPlot(CompositePlot, GenericCompositePlot):
{'title': '15pt'}""")

merge_tools = param.Boolean(default=True, doc="""
Whether to merge all the tools into a single toolbar""")

shared_xaxis = param.Boolean(default=False, doc="""
If enabled the x-axes of the GridSpace will be drawn from the
objects inside the Grid rather than the GridSpace dimensions.""")
Expand All @@ -344,6 +347,13 @@ class GridPlot(CompositePlot, GenericCompositePlot):
If enabled the x-axes of the GridSpace will be drawn from the
objects inside the Grid rather than the GridSpace dimensions.""")

toolbar = param.ObjectSelector(default='above',
objects=["above", "below",
"left", "right", None],
doc="""
The toolbar location, must be one of 'above', 'below',
'left', 'right', None.""")

xaxis = param.ObjectSelector(default=True,
objects=['bottom', 'top', None, True, False], doc="""
Whether and where to display the xaxis, supported options are
Expand Down Expand Up @@ -461,7 +471,8 @@ def initialize_plot(self, ranges=None, plots=[]):
else:
passed_plots.append(None)

plot = gridplot(plots[::-1])
plot = gridplot(plots[::-1], toolbar_position=self.toolbar,
merge_tools=self.merge_tools)
plot = self._make_axes(plot)

title = self._get_title(self.keys[-1])
Expand Down Expand Up @@ -548,9 +559,19 @@ class LayoutPlot(CompositePlot, GenericLayoutPlot):
share their Bokeh data source allowing for linked brushing
and other linked behaviors.""")

merge_tools = param.Boolean(default=True, doc="""
Whether to merge all the tools into a single toolbar""")

tabs = param.Boolean(default=False, doc="""
Whether to display overlaid plots in separate panes""")

toolbar = param.ObjectSelector(default='above',
objects=["above", "below",
"left", "right", None],
doc="""
The toolbar location, must be one of 'above', 'below',
'left', 'right', None.""")

def __init__(self, layout, keys=None, **params):
super(LayoutPlot, self).__init__(layout, keys=keys, **params)
self.layout, self.subplots, self.paths = self._init_layout(layout)
Expand Down Expand Up @@ -756,7 +777,9 @@ def initialize_plot(self, plots=None, ranges=None):
else:
plots = filter_toolboxes(plots)
plots, width = pad_plots(plots)
layout_plot = gridplot(children=plots, width=width, **kwargs)
layout_plot = gridplot(children=plots, width=width,
toolbar_position=self.toolbar,
merge_tools=self.merge_tools, **kwargs)

title = self._get_title(self.keys[-1])
if title:
Expand Down

0 comments on commit 46b1754

Please sign in to comment.