We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Bokeh hover tooltip
We need to implement better default hover settings.

https://docs.bokeh.org/en/1.4.0/docs/reference/models/tools.html#bokeh.models.tools.HoverTool

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `arviz/plots/backends/bokeh/pairplot.py`
Content:
```
1 """Bokeh pairplot."""
2 import warnings
3 from uuid import uuid4
4 
5 import bokeh.plotting as bkp
6 from bokeh.models import ColumnDataSource, CDSView, GroupFilter
7 import numpy as np
8 
9 from . import backend_kwarg_defaults
10 from .. import show_layout
11 from ...kdeplot import plot_kde
12 from ...plot_utils import _scale_fig_size
13 from ....rcparams import rcParams
14 
15 
16 def plot_pair(
17     ax,
18     infdata_group,
19     numvars,
20     figsize,
21     textsize,
22     kind,
23     plot_kwargs,
24     contour,
25     fill_last,
26     divergences,
27     diverging_mask,
28     flat_var_names,
29     backend_kwargs,
30     show,
31 ):
32     """Bokeh pair plot."""
33     if backend_kwargs is None:
34         backend_kwargs = {}
35 
36     backend_kwargs = {
37         **backend_kwarg_defaults(("dpi", "plot.bokeh.figure.dpi"),),
38         **backend_kwargs,
39     }
40     dpi = backend_kwargs.pop("dpi")
41     if numvars == 2:
42         (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 1, numvars - 1)
43 
44         source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))
45 
46         if divergences:
47             divergenve_name = "divergences_{}".format(str(uuid4()))
48             source_dict[divergenve_name] = (
49                 np.array(diverging_mask).astype(bool).astype(int).astype(str)
50             )
51 
52         source = ColumnDataSource(data=source_dict)
53 
54         if divergences:
55             source_nondiv = CDSView(
56                 source=source, filters=[GroupFilter(column_name=divergenve_name, group="0")]
57             )
58             source_div = CDSView(
59                 source=source, filters=[GroupFilter(column_name=divergenve_name, group="1")]
60             )
61 
62         if ax is None:
63             backend_kwargs["width"] = int(figsize[0] * dpi)
64             backend_kwargs["height"] = int(figsize[1] * dpi)
65             ax = bkp.figure(**backend_kwargs)
66 
67         if kind == "scatter":
68             if divergences:
69                 ax.circle(
70                     flat_var_names[0],
71                     flat_var_names[1],
72                     source=source,
73                     view=source_nondiv,
74                     legend_label="non-divergent",
75                 )
76             else:
77                 ax.circle(flat_var_names[0], flat_var_names[1], source=source)
78         elif kind == "kde":
79             plot_kde(
80                 infdata_group[0],
81                 infdata_group[1],
82                 contour=contour,
83                 fill_last=fill_last,
84                 ax=ax,
85                 backend="bokeh",
86                 backend_kwargs={},
87                 show=False,
88             )
89         else:
90             ax.hexbin(infdata_group[0], infdata_group[1], size=0.5)
91             ax.grid.visible = False
92 
93         if divergences:
94             ax.circle(
95                 flat_var_names[0],
96                 flat_var_names[1],
97                 line_color="black",
98                 fill_color="orange",
99                 line_width=1,
100                 size=6,
101                 source=source,
102                 view=source_div,
103                 legend_label="divergent",
104             )
105             ax.legend.click_policy = "hide"
106 
107         ax.xaxis.axis_label = flat_var_names[0]
108         ax.yaxis.axis_label = flat_var_names[1]
109 
110         show_layout(ax, show)
111 
112     else:
113         max_plots = (
114             numvars ** 2 if rcParams["plot.max_subplots"] is None else rcParams["plot.max_subplots"]
115         )
116         vars_to_plot = np.sum(np.arange(numvars).cumsum() < max_plots)
117         if vars_to_plot < numvars:
118             warnings.warn(
119                 "rcParams['plot.max_subplots'] ({max_plots}) is smaller than the number "
120                 "of resulting pair plots with these variables, generating only a "
121                 "{side}x{side} grid".format(max_plots=max_plots, side=vars_to_plot),
122                 UserWarning,
123             )
124             numvars = vars_to_plot
125 
126         (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 2, numvars - 2)
127 
128         if ax is None:
129             ax = []
130             backend_kwargs.setdefault("width", int(figsize[0] / (numvars - 1) * dpi))
131             backend_kwargs.setdefault("height", int(figsize[1] / (numvars - 1) * dpi))
132             for row in range(numvars - 1):
133                 row_ax = []
134                 for col in range(numvars - 1):
135                     if row < col:
136                         row_ax.append(None)
137                     else:
138                         ax_ = bkp.figure(**backend_kwargs)
139                         row_ax.append(ax_)
140                 ax.append(row_ax)
141             ax = np.array(ax)
142 
143         tmp_flat_var_names = None
144         if len(flat_var_names) == len(list(set(flat_var_names))):
145             source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))
146         else:
147             tmp_flat_var_names = ["{}__{}".format(name, str(uuid4())) for name in flat_var_names]
148             source_dict = dict(zip(tmp_flat_var_names, [list(post) for post in infdata_group]))
149         if divergences:
150             divergenve_name = "divergences_{}".format(str(uuid4()))
151             source_dict[divergenve_name] = (
152                 np.array(diverging_mask).astype(bool).astype(int).astype(str)
153             )
154 
155         source = ColumnDataSource(data=source_dict)
156 
157         if divergences:
158             source_nondiv = CDSView(
159                 source=source, filters=[GroupFilter(column_name=divergenve_name, group="0")]
160             )
161             source_div = CDSView(
162                 source=source, filters=[GroupFilter(column_name=divergenve_name, group="1")]
163             )
164 
165         for i in range(0, numvars - 1):
166             var1 = flat_var_names[i] if tmp_flat_var_names is None else tmp_flat_var_names[i]
167 
168             for j in range(0, numvars - 1):
169                 if j < i:
170                     continue
171 
172                 var2 = (
173                     flat_var_names[j + 1]
174                     if tmp_flat_var_names is None
175                     else tmp_flat_var_names[j + 1]
176                 )
177 
178                 if kind == "scatter":
179                     if divergences:
180                         ax[j, i].circle(var1, var2, source=source, view=source_nondiv)
181                     else:
182                         ax[j, i].circle(var1, var2, source=source)
183 
184                 elif kind == "kde":
185                     var1_kde = infdata_group[i]
186                     var2_kde = infdata_group[j + 1]
187                     plot_kde(
188                         var1_kde,
189                         var2_kde,
190                         contour=contour,
191                         fill_last=fill_last,
192                         ax=ax[j, i],
193                         backend="bokeh",
194                         backend_kwargs={},
195                         show=False,
196                         **plot_kwargs
197                     )
198 
199                 else:
200                     var1_hexbin = infdata_group[i]
201                     var2_hexbin = infdata_group[j + 1]
202                     ax[j, i].grid.visible = False
203                     ax[j, i].hexbin(var1_hexbin, var2_hexbin, size=0.5)
204 
205                 if divergences:
206                     ax[j, i].circle(
207                         var1,
208                         var2,
209                         line_color="black",
210                         fill_color="orange",
211                         line_width=1,
212                         size=10,
213                         source=source,
214                         view=source_div,
215                     )
216 
217                 ax[j, i].xaxis.axis_label = flat_var_names[i]
218                 ax[j, i].yaxis.axis_label = flat_var_names[j + 1]
219 
220         show_layout(ax, show)
221 
222     return ax
223
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/arviz/plots/backends/bokeh/pairplot.py b/arviz/plots/backends/bokeh/pairplot.py
--- a/arviz/plots/backends/bokeh/pairplot.py
+++ b/arviz/plots/backends/bokeh/pairplot.py
@@ -39,6 +39,13 @@
     }
     dpi = backend_kwargs.pop("dpi")
     if numvars == 2:
+        if kind == "scatter":
+            tooltips = [
+                (flat_var_names[1], "@{{{}}}".format(flat_var_names[1])),
+                (flat_var_names[0], "@{{{}}}".format(flat_var_names[0])),
+            ]
+            backend_kwargs.setdefault("tooltips", tooltips)
+
         (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 1, numvars - 1)
 
         source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))
@@ -125,21 +132,6 @@
 
         (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 2, numvars - 2)
 
-        if ax is None:
-            ax = []
-            backend_kwargs.setdefault("width", int(figsize[0] / (numvars - 1) * dpi))
-            backend_kwargs.setdefault("height", int(figsize[1] / (numvars - 1) * dpi))
-            for row in range(numvars - 1):
-                row_ax = []
-                for col in range(numvars - 1):
-                    if row < col:
-                        row_ax.append(None)
-                    else:
-                        ax_ = bkp.figure(**backend_kwargs)
-                        row_ax.append(ax_)
-                ax.append(row_ax)
-            ax = np.array(ax)
-
         tmp_flat_var_names = None
         if len(flat_var_names) == len(list(set(flat_var_names))):
             source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))
@@ -162,6 +154,40 @@
                 source=source, filters=[GroupFilter(column_name=divergenve_name, group="1")]
             )
 
+        if ax is None:
+            ax = []
+            backend_kwargs.setdefault("width", int(figsize[0] / (numvars - 1) * dpi))
+            backend_kwargs.setdefault("height", int(figsize[1] / (numvars - 1) * dpi))
+            for row in range(numvars - 1):
+                row_ax = []
+                var2 = (
+                    flat_var_names[row + 1]
+                    if tmp_flat_var_names is None
+                    else tmp_flat_var_names[row + 1]
+                )
+                for col in range(numvars - 1):
+                    if row < col:
+                        row_ax.append(None)
+                        continue
+
+                    var1 = (
+                        flat_var_names[col]
+                        if tmp_flat_var_names is None
+                        else tmp_flat_var_names[col]
+                    )
+                    backend_kwargs_copy = backend_kwargs.copy()
+                    if kind == "scatter":
+                        tooltips = [
+                            (var2, "@{{{}}}".format(var2)),
+                            (var1, "@{{{}}}".format(var1)),
+                        ]
+                        backend_kwargs_copy.setdefault("tooltips", tooltips)
+
+                    ax_ = bkp.figure(**backend_kwargs_copy)
+                    row_ax.append(ax_)
+                ax.append(row_ax)
+            ax = np.array(ax)
+
         for i in range(0, numvars - 1):
             var1 = flat_var_names[i] if tmp_flat_var_names is None else tmp_flat_var_names[i]

{"golden_diff": "diff --git a/arviz/plots/backends/bokeh/pairplot.py b/arviz/plots/backends/bokeh/pairplot.py\n--- a/arviz/plots/backends/bokeh/pairplot.py\n+++ b/arviz/plots/backends/bokeh/pairplot.py\n@@ -39,6 +39,13 @@\n     }\n     dpi = backend_kwargs.pop(\"dpi\")\n     if numvars == 2:\n+        if kind == \"scatter\":\n+            tooltips = [\n+                (flat_var_names[1], \"@{{{}}}\".format(flat_var_names[1])),\n+                (flat_var_names[0], \"@{{{}}}\".format(flat_var_names[0])),\n+            ]\n+            backend_kwargs.setdefault(\"tooltips\", tooltips)\n+\n         (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 1, numvars - 1)\n \n         source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))\n@@ -125,21 +132,6 @@\n \n         (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 2, numvars - 2)\n \n-        if ax is None:\n-            ax = []\n-            backend_kwargs.setdefault(\"width\", int(figsize[0] / (numvars - 1) * dpi))\n-            backend_kwargs.setdefault(\"height\", int(figsize[1] / (numvars - 1) * dpi))\n-            for row in range(numvars - 1):\n-                row_ax = []\n-                for col in range(numvars - 1):\n-                    if row < col:\n-                        row_ax.append(None)\n-                    else:\n-                        ax_ = bkp.figure(**backend_kwargs)\n-                        row_ax.append(ax_)\n-                ax.append(row_ax)\n-            ax = np.array(ax)\n-\n         tmp_flat_var_names = None\n         if len(flat_var_names) == len(list(set(flat_var_names))):\n             source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))\n@@ -162,6 +154,40 @@\n                 source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"1\")]\n             )\n \n+        if ax is None:\n+            ax = []\n+            backend_kwargs.setdefault(\"width\", int(figsize[0] / (numvars - 1) * dpi))\n+            backend_kwargs.setdefault(\"height\", int(figsize[1] / (numvars - 1) * dpi))\n+            for row in range(numvars - 1):\n+                row_ax = []\n+                var2 = (\n+                    flat_var_names[row + 1]\n+                    if tmp_flat_var_names is None\n+                    else tmp_flat_var_names[row + 1]\n+                )\n+                for col in range(numvars - 1):\n+                    if row < col:\n+                        row_ax.append(None)\n+                        continue\n+\n+                    var1 = (\n+                        flat_var_names[col]\n+                        if tmp_flat_var_names is None\n+                        else tmp_flat_var_names[col]\n+                    )\n+                    backend_kwargs_copy = backend_kwargs.copy()\n+                    if kind == \"scatter\":\n+                        tooltips = [\n+                            (var2, \"@{{{}}}\".format(var2)),\n+                            (var1, \"@{{{}}}\".format(var1)),\n+                        ]\n+                        backend_kwargs_copy.setdefault(\"tooltips\", tooltips)\n+\n+                    ax_ = bkp.figure(**backend_kwargs_copy)\n+                    row_ax.append(ax_)\n+                ax.append(row_ax)\n+            ax = np.array(ax)\n+\n         for i in range(0, numvars - 1):\n             var1 = flat_var_names[i] if tmp_flat_var_names is None else tmp_flat_var_names[i]\n", "issue": "Bokeh hover tooltip\nWe need to implement better default hover settings.\r\n\r\nhttps://docs.bokeh.org/en/1.4.0/docs/reference/models/tools.html#bokeh.models.tools.HoverTool\n", "before_files": [{"content": "\"\"\"Bokeh pairplot.\"\"\"\nimport warnings\nfrom uuid import uuid4\n\nimport bokeh.plotting as bkp\nfrom bokeh.models import ColumnDataSource, CDSView, GroupFilter\nimport numpy as np\n\nfrom . import backend_kwarg_defaults\nfrom .. import show_layout\nfrom ...kdeplot import plot_kde\nfrom ...plot_utils import _scale_fig_size\nfrom ....rcparams import rcParams\n\n\ndef plot_pair(\n    ax,\n    infdata_group,\n    numvars,\n    figsize,\n    textsize,\n    kind,\n    plot_kwargs,\n    contour,\n    fill_last,\n    divergences,\n    diverging_mask,\n    flat_var_names,\n    backend_kwargs,\n    show,\n):\n    \"\"\"Bokeh pair plot.\"\"\"\n    if backend_kwargs is None:\n        backend_kwargs = {}\n\n    backend_kwargs = {\n        **backend_kwarg_defaults((\"dpi\", \"plot.bokeh.figure.dpi\"),),\n        **backend_kwargs,\n    }\n    dpi = backend_kwargs.pop(\"dpi\")\n    if numvars == 2:\n        (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 1, numvars - 1)\n\n        source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))\n\n        if divergences:\n            divergenve_name = \"divergences_{}\".format(str(uuid4()))\n            source_dict[divergenve_name] = (\n                np.array(diverging_mask).astype(bool).astype(int).astype(str)\n            )\n\n        source = ColumnDataSource(data=source_dict)\n\n        if divergences:\n            source_nondiv = CDSView(\n                source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"0\")]\n            )\n            source_div = CDSView(\n                source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"1\")]\n            )\n\n        if ax is None:\n            backend_kwargs[\"width\"] = int(figsize[0] * dpi)\n            backend_kwargs[\"height\"] = int(figsize[1] * dpi)\n            ax = bkp.figure(**backend_kwargs)\n\n        if kind == \"scatter\":\n            if divergences:\n                ax.circle(\n                    flat_var_names[0],\n                    flat_var_names[1],\n                    source=source,\n                    view=source_nondiv,\n                    legend_label=\"non-divergent\",\n                )\n            else:\n                ax.circle(flat_var_names[0], flat_var_names[1], source=source)\n        elif kind == \"kde\":\n            plot_kde(\n                infdata_group[0],\n                infdata_group[1],\n                contour=contour,\n                fill_last=fill_last,\n                ax=ax,\n                backend=\"bokeh\",\n                backend_kwargs={},\n                show=False,\n            )\n        else:\n            ax.hexbin(infdata_group[0], infdata_group[1], size=0.5)\n            ax.grid.visible = False\n\n        if divergences:\n            ax.circle(\n                flat_var_names[0],\n                flat_var_names[1],\n                line_color=\"black\",\n                fill_color=\"orange\",\n                line_width=1,\n                size=6,\n                source=source,\n                view=source_div,\n                legend_label=\"divergent\",\n            )\n            ax.legend.click_policy = \"hide\"\n\n        ax.xaxis.axis_label = flat_var_names[0]\n        ax.yaxis.axis_label = flat_var_names[1]\n\n        show_layout(ax, show)\n\n    else:\n        max_plots = (\n            numvars ** 2 if rcParams[\"plot.max_subplots\"] is None else rcParams[\"plot.max_subplots\"]\n        )\n        vars_to_plot = np.sum(np.arange(numvars).cumsum() < max_plots)\n        if vars_to_plot < numvars:\n            warnings.warn(\n                \"rcParams['plot.max_subplots'] ({max_plots}) is smaller than the number \"\n                \"of resulting pair plots with these variables, generating only a \"\n                \"{side}x{side} grid\".format(max_plots=max_plots, side=vars_to_plot),\n                UserWarning,\n            )\n            numvars = vars_to_plot\n\n        (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 2, numvars - 2)\n\n        if ax is None:\n            ax = []\n            backend_kwargs.setdefault(\"width\", int(figsize[0] / (numvars - 1) * dpi))\n            backend_kwargs.setdefault(\"height\", int(figsize[1] / (numvars - 1) * dpi))\n            for row in range(numvars - 1):\n                row_ax = []\n                for col in range(numvars - 1):\n                    if row < col:\n                        row_ax.append(None)\n                    else:\n                        ax_ = bkp.figure(**backend_kwargs)\n                        row_ax.append(ax_)\n                ax.append(row_ax)\n            ax = np.array(ax)\n\n        tmp_flat_var_names = None\n        if len(flat_var_names) == len(list(set(flat_var_names))):\n            source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))\n        else:\n            tmp_flat_var_names = [\"{}__{}\".format(name, str(uuid4())) for name in flat_var_names]\n            source_dict = dict(zip(tmp_flat_var_names, [list(post) for post in infdata_group]))\n        if divergences:\n            divergenve_name = \"divergences_{}\".format(str(uuid4()))\n            source_dict[divergenve_name] = (\n                np.array(diverging_mask).astype(bool).astype(int).astype(str)\n            )\n\n        source = ColumnDataSource(data=source_dict)\n\n        if divergences:\n            source_nondiv = CDSView(\n                source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"0\")]\n            )\n            source_div = CDSView(\n                source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"1\")]\n            )\n\n        for i in range(0, numvars - 1):\n            var1 = flat_var_names[i] if tmp_flat_var_names is None else tmp_flat_var_names[i]\n\n            for j in range(0, numvars - 1):\n                if j < i:\n                    continue\n\n                var2 = (\n                    flat_var_names[j + 1]\n                    if tmp_flat_var_names is None\n                    else tmp_flat_var_names[j + 1]\n                )\n\n                if kind == \"scatter\":\n                    if divergences:\n                        ax[j, i].circle(var1, var2, source=source, view=source_nondiv)\n                    else:\n                        ax[j, i].circle(var1, var2, source=source)\n\n                elif kind == \"kde\":\n                    var1_kde = infdata_group[i]\n                    var2_kde = infdata_group[j + 1]\n                    plot_kde(\n                        var1_kde,\n                        var2_kde,\n                        contour=contour,\n                        fill_last=fill_last,\n                        ax=ax[j, i],\n                        backend=\"bokeh\",\n                        backend_kwargs={},\n                        show=False,\n                        **plot_kwargs\n                    )\n\n                else:\n                    var1_hexbin = infdata_group[i]\n                    var2_hexbin = infdata_group[j + 1]\n                    ax[j, i].grid.visible = False\n                    ax[j, i].hexbin(var1_hexbin, var2_hexbin, size=0.5)\n\n                if divergences:\n                    ax[j, i].circle(\n                        var1,\n                        var2,\n                        line_color=\"black\",\n                        fill_color=\"orange\",\n                        line_width=1,\n                        size=10,\n                        source=source,\n                        view=source_div,\n                    )\n\n                ax[j, i].xaxis.axis_label = flat_var_names[i]\n                ax[j, i].yaxis.axis_label = flat_var_names[j + 1]\n\n        show_layout(ax, show)\n\n    return ax\n", "path": "arviz/plots/backends/bokeh/pairplot.py"}], "after_files": [{"content": "\"\"\"Bokeh pairplot.\"\"\"\nimport warnings\nfrom uuid import uuid4\n\nimport bokeh.plotting as bkp\nfrom bokeh.models import ColumnDataSource, CDSView, GroupFilter\nimport numpy as np\n\nfrom . import backend_kwarg_defaults\nfrom .. import show_layout\nfrom ...kdeplot import plot_kde\nfrom ...plot_utils import _scale_fig_size\nfrom ....rcparams import rcParams\n\n\ndef plot_pair(\n    ax,\n    infdata_group,\n    numvars,\n    figsize,\n    textsize,\n    kind,\n    plot_kwargs,\n    contour,\n    fill_last,\n    divergences,\n    diverging_mask,\n    flat_var_names,\n    backend_kwargs,\n    show,\n):\n    \"\"\"Bokeh pair plot.\"\"\"\n    if backend_kwargs is None:\n        backend_kwargs = {}\n\n    backend_kwargs = {\n        **backend_kwarg_defaults((\"dpi\", \"plot.bokeh.figure.dpi\"),),\n        **backend_kwargs,\n    }\n    dpi = backend_kwargs.pop(\"dpi\")\n    if numvars == 2:\n        if kind == \"scatter\":\n            tooltips = [\n                (flat_var_names[1], \"@{{{}}}\".format(flat_var_names[1])),\n                (flat_var_names[0], \"@{{{}}}\".format(flat_var_names[0])),\n            ]\n            backend_kwargs.setdefault(\"tooltips\", tooltips)\n\n        (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 1, numvars - 1)\n\n        source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))\n\n        if divergences:\n            divergenve_name = \"divergences_{}\".format(str(uuid4()))\n            source_dict[divergenve_name] = (\n                np.array(diverging_mask).astype(bool).astype(int).astype(str)\n            )\n\n        source = ColumnDataSource(data=source_dict)\n\n        if divergences:\n            source_nondiv = CDSView(\n                source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"0\")]\n            )\n            source_div = CDSView(\n                source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"1\")]\n            )\n\n        if ax is None:\n            backend_kwargs[\"width\"] = int(figsize[0] * dpi)\n            backend_kwargs[\"height\"] = int(figsize[1] * dpi)\n            ax = bkp.figure(**backend_kwargs)\n\n        if kind == \"scatter\":\n            if divergences:\n                ax.circle(\n                    flat_var_names[0],\n                    flat_var_names[1],\n                    source=source,\n                    view=source_nondiv,\n                    legend_label=\"non-divergent\",\n                )\n            else:\n                ax.circle(flat_var_names[0], flat_var_names[1], source=source)\n        elif kind == \"kde\":\n            plot_kde(\n                infdata_group[0],\n                infdata_group[1],\n                contour=contour,\n                fill_last=fill_last,\n                ax=ax,\n                backend=\"bokeh\",\n                backend_kwargs={},\n                show=False,\n            )\n        else:\n            ax.hexbin(infdata_group[0], infdata_group[1], size=0.5)\n            ax.grid.visible = False\n\n        if divergences:\n            ax.circle(\n                flat_var_names[0],\n                flat_var_names[1],\n                line_color=\"black\",\n                fill_color=\"orange\",\n                line_width=1,\n                size=6,\n                source=source,\n                view=source_div,\n                legend_label=\"divergent\",\n            )\n            ax.legend.click_policy = \"hide\"\n\n        ax.xaxis.axis_label = flat_var_names[0]\n        ax.yaxis.axis_label = flat_var_names[1]\n\n        show_layout(ax, show)\n\n    else:\n        max_plots = (\n            numvars ** 2 if rcParams[\"plot.max_subplots\"] is None else rcParams[\"plot.max_subplots\"]\n        )\n        vars_to_plot = np.sum(np.arange(numvars).cumsum() < max_plots)\n        if vars_to_plot < numvars:\n            warnings.warn(\n                \"rcParams['plot.max_subplots'] ({max_plots}) is smaller than the number \"\n                \"of resulting pair plots with these variables, generating only a \"\n                \"{side}x{side} grid\".format(max_plots=max_plots, side=vars_to_plot),\n                UserWarning,\n            )\n            numvars = vars_to_plot\n\n        (figsize, _, _, _, _, _) = _scale_fig_size(figsize, textsize, numvars - 2, numvars - 2)\n\n        tmp_flat_var_names = None\n        if len(flat_var_names) == len(list(set(flat_var_names))):\n            source_dict = dict(zip(flat_var_names, [list(post) for post in infdata_group]))\n        else:\n            tmp_flat_var_names = [\"{}__{}\".format(name, str(uuid4())) for name in flat_var_names]\n            source_dict = dict(zip(tmp_flat_var_names, [list(post) for post in infdata_group]))\n        if divergences:\n            divergenve_name = \"divergences_{}\".format(str(uuid4()))\n            source_dict[divergenve_name] = (\n                np.array(diverging_mask).astype(bool).astype(int).astype(str)\n            )\n\n        source = ColumnDataSource(data=source_dict)\n\n        if divergences:\n            source_nondiv = CDSView(\n                source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"0\")]\n            )\n            source_div = CDSView(\n                source=source, filters=[GroupFilter(column_name=divergenve_name, group=\"1\")]\n            )\n\n        if ax is None:\n            ax = []\n            backend_kwargs.setdefault(\"width\", int(figsize[0] / (numvars - 1) * dpi))\n            backend_kwargs.setdefault(\"height\", int(figsize[1] / (numvars - 1) * dpi))\n            for row in range(numvars - 1):\n                row_ax = []\n                var2 = (\n                    flat_var_names[row + 1]\n                    if tmp_flat_var_names is None\n                    else tmp_flat_var_names[row + 1]\n                )\n                for col in range(numvars - 1):\n                    if row < col:\n                        row_ax.append(None)\n                        continue\n\n                    var1 = (\n                        flat_var_names[col]\n                        if tmp_flat_var_names is None\n                        else tmp_flat_var_names[col]\n                    )\n                    backend_kwargs_copy = backend_kwargs.copy()\n                    if kind == \"scatter\":\n                        tooltips = [\n                            (var2, \"@{{{}}}\".format(var2)),\n                            (var1, \"@{{{}}}\".format(var1)),\n                        ]\n                        backend_kwargs_copy.setdefault(\"tooltips\", tooltips)\n\n                    ax_ = bkp.figure(**backend_kwargs_copy)\n                    row_ax.append(ax_)\n                ax.append(row_ax)\n            ax = np.array(ax)\n\n        for i in range(0, numvars - 1):\n            var1 = flat_var_names[i] if tmp_flat_var_names is None else tmp_flat_var_names[i]\n\n            for j in range(0, numvars - 1):\n                if j < i:\n                    continue\n\n                var2 = (\n                    flat_var_names[j + 1]\n                    if tmp_flat_var_names is None\n                    else tmp_flat_var_names[j + 1]\n                )\n\n                if kind == \"scatter\":\n                    if divergences:\n                        ax[j, i].circle(var1, var2, source=source, view=source_nondiv)\n                    else:\n                        ax[j, i].circle(var1, var2, source=source)\n\n                elif kind == \"kde\":\n                    var1_kde = infdata_group[i]\n                    var2_kde = infdata_group[j + 1]\n                    plot_kde(\n                        var1_kde,\n                        var2_kde,\n                        contour=contour,\n                        fill_last=fill_last,\n                        ax=ax[j, i],\n                        backend=\"bokeh\",\n                        backend_kwargs={},\n                        show=False,\n                        **plot_kwargs\n                    )\n\n                else:\n                    var1_hexbin = infdata_group[i]\n                    var2_hexbin = infdata_group[j + 1]\n                    ax[j, i].grid.visible = False\n                    ax[j, i].hexbin(var1_hexbin, var2_hexbin, size=0.5)\n\n                if divergences:\n                    ax[j, i].circle(\n                        var1,\n                        var2,\n                        line_color=\"black\",\n                        fill_color=\"orange\",\n                        line_width=1,\n                        size=10,\n                        source=source,\n                        view=source_div,\n                    )\n\n                ax[j, i].xaxis.axis_label = flat_var_names[i]\n                ax[j, i].yaxis.axis_label = flat_var_names[j + 1]\n\n        show_layout(ax, show)\n\n    return ax\n", "path": "arviz/plots/backends/bokeh/pairplot.py"}]}