Repository: arviz-devs/arviz

Issue:
Bokeh text
Make sure that bokeh texts are either from columndatasource or are inside lists

    ax.text(x='x', y='y', text='text'

or 

    ax.text(x=[...], y=[...], text=[...]


Discussion:

Resolving patch:
diff --git a/arviz/plots/backends/bokeh/khatplot.py b/arviz/plots/backends/bokeh/khatplot.py
--- a/arviz/plots/backends/bokeh/khatplot.py
+++ b/arviz/plots/backends/bokeh/khatplot.py
@@ -3,7 +3,7 @@
 
 import bokeh.plotting as bkp
 import numpy as np
-from bokeh.models import ColumnDataSource, Span
+from bokeh.models import Span
 
 from . import backend_kwarg_defaults
 from ....stats.stats_utils import histogram
@@ -49,8 +49,7 @@ def plot_khat(
     if annotate:
         idxs = xdata[khats > 1]
         for idx in idxs:
-            cds = ColumnDataSource({"x": [idx], "y": [khats[idx]], "text": [coord_labels[idx]],})
-            ax.text(x="x", y="y", text="text", source=cds)
+            ax.text(x=[idx], y=[khats[idx]], text=[coord_labels[idx]])
 
     for hline in [0, 0.5, 0.7, 1]:
         _hline = Span(
@@ -72,14 +71,11 @@ def plot_khat(
         bin_edges = bin_edges[(bin_edges >= ymin) & (bin_edges <= ymax)]
         hist, _, _ = histogram(khats, bin_edges)
         for idx, count in enumerate(hist):
-            cds = ColumnDataSource(
-                {
-                    "x": [(n_data_points - 1 + xmax) / 2],
-                    "y": [np.mean(bin_edges[idx : idx + 2])],
-                    "text": [bin_format.format(count, count / n_data_points * 100)],
-                }
+            ax.text(
+                x=[(n_data_points - 1 + xmax) / 2],
+                y=[np.mean(bin_edges[idx : idx + 2])],
+                text=[bin_format.format(count, count / n_data_points * 100)],
             )
-            ax.text(x="x", y="y", text="text", source=cds)
         ax.x_range._property_values["end"] = xmax + 1  # pylint: disable=protected-access
     ax.xaxis.axis_label = "Data Point"
     ax.yaxis.axis_label = "Shape parameter k"
diff --git a/arviz/plots/backends/bokeh/posteriorplot.py b/arviz/plots/backends/bokeh/posteriorplot.py
--- a/arviz/plots/backends/bokeh/posteriorplot.py
+++ b/arviz/plots/backends/bokeh/posteriorplot.py
@@ -5,7 +5,6 @@
 import bokeh.plotting as bkp
 import numpy as np
 from bokeh.layouts import gridplot
-from bokeh.models import ColumnDataSource
 from bokeh.models.annotations import Title
 from scipy.stats import mode
 
@@ -146,11 +145,7 @@ def display_ref_val(max_data):
         )
         ax.line([val, val], [0, 0.8 * max_data], line_color="blue", line_alpha=0.65)
 
-        cds = ColumnDataSource(
-            {"x": [values.mean()], "y": [max_data * 0.6], "text": [ref_in_posterior]}
-        )
-
-        ax.text(x="x", y="y", text="text", source=cds, text_align="center")
+        ax.text(x=[values.mean()], y=[max_data * 0.6], text=[ref_in_posterior], text_align="center")
 
     def display_rope(max_data):
         if rope is None:
@@ -185,11 +180,7 @@ def display_rope(max_data):
             text_font_size="{}pt".format(ax_labelsize), text_color="black", text_align="center"
         )
 
-        cds = ColumnDataSource(
-            {"x": vals, "y": [max_data * 0.2, max_data * 0.2], "text": list(map(str, vals))}
-        )
-
-        ax.text(x="x", y="y", text="text", source=cds, **text_props)
+        ax.text(x=vals, y=[max_data * 0.2, max_data * 0.2], text=list(map(str, vals)), **text_props)
 
     def display_point_estimate(max_data):
         if not point_estimate:
@@ -212,9 +203,7 @@ def display_point_estimate(max_data):
             point_estimate=point_estimate, point_value=point_value, sig_figs=sig_figs
         )
 
-        cds = ColumnDataSource({"x": [point_value], "y": [max_data * 0.8], "text": [point_text]})
-
-        ax.text(x="x", y="y", text="text", source=cds, text_align="center")
+        ax.text(x=[point_value], y=[max_data * 0.8], text=[point_text], text_align="center")
 
     def display_hpd(max_data):
         # np.ndarray with 2 entries, min and max
@@ -231,17 +220,14 @@ def display_hpd(max_data):
                 line_color="black",
             )
 
-            cds = ColumnDataSource(
-                {
-                    "x": list(hpdi) + [(hpdi[0] + hpdi[1]) / 2],
-                    "y": [max_data * 0.07, max_data * 0.07, max_data * 0.3],
-                    "text": list(map(str, map(lambda x: round_num(x, round_to), hpdi)))
-                    + [format_as_percent(credible_interval) + " HPD"],
-                }
+            ax.text(
+                x=list(hpdi) + [(hpdi[0] + hpdi[1]) / 2],
+                y=[max_data * 0.07, max_data * 0.07, max_data * 0.3],
+                text=list(map(str, map(lambda x: round_num(x, round_to), hpdi)))
+                + [format_as_percent(credible_interval) + " HPD"],
+                text_align="center",
             )
 
-            ax.text(x="x", y="y", text="text", source=cds, text_align="center")
-
     def format_axes():
         ax.yaxis.visible = False
         ax.yaxis.major_tick_line_color = None


Test patch: