From d60bff72d66b1ecd7557f023907d5674686c58de Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 25 May 2017 12:55:13 +0100 Subject: [PATCH] Compatibility fixes for bokeh 0.12.6 release --- holoviews/plotting/bokeh/chart.py | 12 ++++++++---- holoviews/plotting/bokeh/renderer.py | 10 +++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py index 4ca049815f..55a4d0b8ef 100644 --- a/holoviews/plotting/bokeh/chart.py +++ b/holoviews/plotting/bokeh/chart.py @@ -2,10 +2,6 @@ import numpy as np import param -try: - from bokeh.charts import BoxPlot as BokehBoxPlot -except: - BokehBoxPlot = None, None from bokeh.models import (GlyphRenderer, ColumnDataSource, DataRange1d, Range1d, CategoricalColorMapper, CustomJS, HoverTool) @@ -24,6 +20,14 @@ from .path import PathPlot, PolygonPlot from .util import update_plot, bokeh_version, expand_batched_style, categorize_array +try: + if bokeh_version > '0.12.5': + from bkcharts import BoxPlot as BokehBoxPlot + else: + from bokeh.charts import BoxPlot as BokehBoxPlot +except: + BokehBoxPlot = None, None + class PointPlot(LegendPlot, ColorbarPlot): diff --git a/holoviews/plotting/bokeh/renderer.py b/holoviews/plotting/bokeh/renderer.py index c531b91160..f2e9ad7ce7 100644 --- a/holoviews/plotting/bokeh/renderer.py +++ b/holoviews/plotting/bokeh/renderer.py @@ -5,7 +5,6 @@ from bokeh.application.handlers import FunctionHandler from bokeh.application import Application -from bokeh.charts import Chart from bokeh.document import Document from bokeh.embed import notebook_div, autoload_server from bokeh.io import load_notebook, curdoc, show as bkshow @@ -22,6 +21,13 @@ from .widgets import BokehScrubberWidget, BokehSelectionWidget, BokehServerWidgets from .util import compute_static_patch, serialize_json, attach_periodic, bokeh_version +try: + if bokeh_version > '0.12.5': + from bkcharts import Chart + else: + from bokeh.charts import Chart +except: + Chart = None class BokehRenderer(Renderer): @@ -259,3 +265,5 @@ def load_nb(cls, inline=True): """ kwargs = {'notebook_type': 'jupyter'} if bokeh_version > '0.12.5' else {} load_notebook(hide_banner=True, resources=INLINE if inline else CDN, **kwargs) + from bokeh.io import _state + _state.output_notebook()