Skip to content

Commit

Permalink
Simplified root handling
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 9, 2018
1 parent c5a4774 commit 2021e8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
15 changes: 3 additions & 12 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,6 @@ def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
self.handles['yaxis'] = plot.yaxis[0]
self.handles['y_range'] = plot.y_range
self.handles['plot'] = plot
if self.top_level and not self._root:
self.set_root(plot)

self._init_glyphs(plot, element, ranges, source)
if not self.overlaid:
Expand Down Expand Up @@ -1477,13 +1475,7 @@ def initialize_plot(self, ranges=None, plot=None, plots=None):
if plot is None and not self.tabs and not self.batched:
plot = self._init_plot(key, element, ranges=ranges, plots=plots)
self._init_axes(plot)

if self.tabs:
self.handles['plot'] = Tabs()
else:
self.handles['plot'] = plot
if self.top_level and not self._root:
self.set_root(self.handles['plot'])
self.handles['plot'] = plot

if plot and not self.overlaid:
self._update_plot(key, plot, element)
Expand All @@ -1508,13 +1500,13 @@ def initialize_plot(self, ranges=None, plot=None, plots=None):
self._merge_tools(subplot)

if self.tabs:
self.handles['plot'].tabs = panels

self.handles['plot'] = Tabs(tabs=panels)
elif not self.overlaid:
self._process_legend()
self.drawn = True
self.handles['plots'] = plots

self._update_callbacks(self.handles['plot'])
if 'plot' in self.handles and not self.tabs:
plot = self.handles['plot']
self.handles['xaxis'] = plot.xaxis[0]
Expand All @@ -1526,7 +1518,6 @@ def initialize_plot(self, ranges=None, plot=None, plots=None):

if self.top_level:
self.init_links()
self._update_callbacks(self.handles['plot'])

self._execute_hooks(element)

Expand Down
11 changes: 4 additions & 7 deletions holoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def _create_subplots(self, layout, ranges):
else:
subplot = plotting_class(view, dimensions=self.dimensions,
show_title=False, subplot=True,
renderer=self.renderer, root=self.root,
renderer=self.renderer,
ranges=frame_ranges, uniform=self.uniform,
keys=self.keys, **dict(opts, **kwargs))
collapsed_layout[coord] = (subplot.layout
Expand Down Expand Up @@ -583,13 +583,12 @@ def initialize_plot(self, ranges=None, plots=[]):
self.handles['plot'] = plot
self.handles['plots'] = plots

self._update_callbacks(plot)
if self.shared_datasource:
self.sync_sources()

if self.top_level:
self.set_root(plot)
self.init_links()
self._update_callbacks(plot)

self.drawn = True

Expand Down Expand Up @@ -800,7 +799,7 @@ def _create_subplots(self, layout, positions, layout_dimensions, ranges, num=0):
layout_dimensions=layout_dimensions,
ranges=ranges, subplot=True,
uniform=self.uniform, layout_num=num,
renderer=self.renderer, root=self.root,
renderer=self.renderer,
**dict({'shared_axes': self.shared_axes},
**plotopts))
subplots[pos] = subplot
Expand Down Expand Up @@ -926,17 +925,15 @@ def initialize_plot(self, plots=None, ranges=None):
self.handles['title'] = title
layout_plot = Column(title, layout_plot, **kwargs)


self.handles['plot'] = layout_plot
self.handles['plots'] = plots

self._update_callbacks(layout_plot)
if self.shared_datasource:
self.sync_sources()

if self.top_level:
self.set_root(layout_plot)
self.init_links()
self._update_callbacks(layout_plot)

self.drawn = True

Expand Down

0 comments on commit 2021e8b

Please sign in to comment.