diff --git a/holoviews/plotting/bokeh/renderer.py b/holoviews/plotting/bokeh/renderer.py index 757243fcc7..0bb288a9f2 100644 --- a/holoviews/plotting/bokeh/renderer.py +++ b/holoviews/plotting/bokeh/renderer.py @@ -75,6 +75,7 @@ def figure_data(self, plot, fmt='html', **kwargs): comms_target = str(uuid.uuid4()) doc.last_comms_target = comms_target div = notebook_div(plot.state, comms_target) + plot.document = doc return div else: return notebook_div(plot.state) diff --git a/holoviews/plotting/bokeh/widgets.py b/holoviews/plotting/bokeh/widgets.py index 3ba97c8ff7..27bffb21f2 100644 --- a/holoviews/plotting/bokeh/widgets.py +++ b/holoviews/plotting/bokeh/widgets.py @@ -46,11 +46,12 @@ def _plot_figure(self, idx, fig_format='json'): if self.embed or fig_format == 'html' or bokeh_lt_011: return self.renderer.html(self.plot, fig_format) else: - doc = state.document + doc = self.plot.document if hasattr(doc, 'last_comms_handle'): handle = doc.last_comms_handle else: + doc.add_root(self.plot.state) handle = _CommsHandle(get_comms(doc.last_comms_target), doc, doc.to_json()) doc.last_comms_handle = handle @@ -61,6 +62,7 @@ def _plot_figure(self, idx, fig_format='json'): else: msg = Document._compute_patch_between_json(handle.json, to_json) handle._json = to_json + print msg handle.comms.send(json.dumps(msg))