We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
plot_pair axis labels no longer include coords
**Describe the bug**
Using `plot_pair` with a selection of `coords`, I got a plot where the axis labels only show `var_names`, so different `coords` get the same label.

**To Reproduce**
```
test_idata = arviz.from_dict(
    posterior = dict(a=numpy.random.rand(1, 10, 3), b=numpy.random.rand(1 ,10, 1)),
    dims={'a':['a_dim',]},
    coords=dict(a_dim=['test_A', 'test_B', 'test_C'])
)
arviz.plot_pair(
    test_idata, 
    coords=dict(a_dim=['test_A', 'test_B']),
    kind='kde'
);
```

![grafik](https://user-images.githubusercontent.com/45510988/106592082-56527b80-654f-11eb-95ed-c9041188c4c0.png)


**Expected behavior**
Axis labels should also include the `coords` to be unique (in this case a_test_A or similar).

**Additional context**
arviz_version : 0.11.0


--- 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/pairplot.py`
Content:
```
1 """Plot a scatter, kde and/or hexbin of sampled parameters."""
2 import warnings
3 from typing import List, Optional, Union
4 
5 import numpy as np
6 
7 from ..data import convert_to_dataset
8 from ..rcparams import rcParams
9 from ..utils import _var_names, get_coords
10 from .plot_utils import (
11     get_plotting_function,
12     xarray_to_ndarray,
13     filter_plotters_list,
14     xarray_var_iter,
15 )
16 
17 
18 def plot_pair(
19     data,
20     group="posterior",
21     var_names: Optional[List[str]] = None,
22     filter_vars: Optional[str] = None,
23     coords=None,
24     marginals=False,
25     figsize=None,
26     textsize=None,
27     kind: Union[str, List[str]] = "scatter",
28     gridsize="auto",
29     contour: Optional[bool] = None,
30     plot_kwargs=None,
31     fill_last=False,
32     divergences=False,
33     colorbar=False,
34     ax=None,
35     divergences_kwargs=None,
36     scatter_kwargs=None,
37     kde_kwargs=None,
38     hexbin_kwargs=None,
39     backend=None,
40     backend_kwargs=None,
41     marginal_kwargs=None,
42     point_estimate=None,
43     point_estimate_kwargs=None,
44     point_estimate_marker_kwargs=None,
45     reference_values=None,
46     reference_values_kwargs=None,
47     show=None,
48 ):
49     """
50     Plot a scatter, kde and/or hexbin matrix with (optional) marginals on the diagonal.
51 
52     Parameters
53     ----------
54     data: obj
55         Any object that can be converted to an az.InferenceData object
56         Refer to documentation of az.convert_to_dataset for details
57     group: str, optional
58         Specifies which InferenceData group should be plotted.  Defaults to 'posterior'.
59     var_names: list of variable names, optional
60         Variables to be plotted, if None all variable are plotted. Prefix the
61         variables by `~` when you want to exclude them from the plot.
62     filter_vars: {None, "like", "regex"}, optional, default=None
63         If `None` (default), interpret var_names as the real variables names. If "like",
64         interpret var_names as substrings of the real variables names. If "regex",
65         interpret var_names as regular expressions on the real variables names. A la
66         `pandas.filter`.
67     coords: mapping, optional
68         Coordinates of var_names to be plotted. Passed to `Dataset.sel`
69     marginals: bool, optional
70         If True pairplot will include marginal distributions for every variable
71     figsize: figure size tuple
72         If None, size is (8 + numvars, 8 + numvars)
73     textsize: int
74         Text size for labels. If None it will be autoscaled based on figsize.
75     kind : str or List[str]
76         Type of plot to display (scatter, kde and/or hexbin)
77     gridsize: int or (int, int), optional
78         Only works for kind=hexbin.
79         The number of hexagons in the x-direction. The corresponding number of hexagons in the
80         y-direction is chosen such that the hexagons are approximately regular.
81         Alternatively, gridsize can be a tuple with two elements specifying the number of hexagons
82         in the x-direction and the y-direction.
83     contour : bool, optional, deprecated, Defaults to True.
84         If True plot the 2D KDE using contours, otherwise plot a smooth 2D KDE. Defaults to True.
85         **Note:** this default is implemented in the body of the code, not in argument processing.
86     fill_last : bool
87         If True fill the last contour of the 2D KDE plot. Defaults to True.
88     divergences: Boolean
89         If True divergences will be plotted in a different color, only if group is either 'prior'
90         or 'posterior'.
91     colorbar: bool
92         If True a colorbar will be included as part of the plot (Defaults to False).
93         Only works when kind=hexbin
94     ax: axes, optional
95         Matplotlib axes or bokeh figures.
96     divergences_kwargs: dicts, optional
97         Additional keywords passed to ax.scatter for divergences
98     scatter_kwargs:
99         Additional keywords passed to ax.plot when using scatter kind
100     kde_kwargs: dict, optional
101         Additional keywords passed to az.plot_kde when using kde kind
102     hexbin_kwargs: dict, optional
103         Additional keywords passed to ax.hexbin when using hexbin kind
104     backend: str, optional
105         Select plotting backend {"matplotlib","bokeh"}. Default "matplotlib".
106     backend_kwargs: bool, optional
107         These are kwargs specific to the backend being used. For additional documentation
108         check the plotting method of the backend.
109     marginal_kwargs: dict, optional
110         Additional keywords passed to az.plot_dist, modifying the marginal distributions
111         plotted in the diagonal.
112     point_estimate: str, optional
113         Select point estimate from 'mean', 'mode' or 'median'. The point estimate will be
114         plotted using a scatter marker and vertical/horizontal lines.
115     point_estimate_kwargs: dict, optional
116         Additional keywords passed to ax.vline, ax.hline (matplotlib) or ax.square, Span (bokeh)
117     point_estimate_marker_kwargs: dict, optional
118         Additional keywords passed to ax.scatter in point estimate plot. Not available in bokeh
119     reference_values: dict, optional
120         Reference values for the plotted variables. The Reference values will be plotted
121         using a scatter marker
122     reference_values_kwargs: dict, optional
123         Additional keywords passed to ax.plot or ax.circle in reference values plot
124     show: bool, optional
125         Call backend show function.
126 
127     Returns
128     -------
129     axes: matplotlib axes or bokeh figures
130 
131     Examples
132     --------
133     KDE Pair Plot
134 
135     .. plot::
136         :context: close-figs
137 
138         >>> import arviz as az
139         >>> centered = az.load_arviz_data('centered_eight')
140         >>> coords = {'school': ['Choate', 'Deerfield']}
141         >>> az.plot_pair(centered,
142         >>>             var_names=['theta', 'mu', 'tau'],
143         >>>             kind='kde',
144         >>>             coords=coords,
145         >>>             divergences=True,
146         >>>             textsize=18)
147 
148     Hexbin pair plot
149 
150     .. plot::
151         :context: close-figs
152 
153         >>> az.plot_pair(centered,
154         >>>             var_names=['theta', 'mu'],
155         >>>             coords=coords,
156         >>>             textsize=18,
157         >>>             kind='hexbin')
158 
159     Pair plot showing divergences and select variables with regular expressions
160 
161     .. plot::
162         :context: close-figs
163 
164         >>> az.plot_pair(centered,
165         ...             var_names=['^t', 'mu'],
166         ...             filter_vars="regex",
167         ...             coords=coords,
168         ...             divergences=True,
169         ...             textsize=18)
170     """
171     valid_kinds = ["scatter", "kde", "hexbin"]
172     kind_boolean: Union[bool, List[bool]]
173     if isinstance(kind, str):
174         kind_boolean = kind in valid_kinds
175     else:
176         kind_boolean = [kind[i] in valid_kinds for i in range(len(kind))]
177     if not np.all(kind_boolean):
178         raise ValueError((f"Plot type {kind} not recognized." "Plot type must be in {valid_kinds}"))
179     if fill_last or contour:
180         warnings.warn(
181             "fill_last and contour will be deprecated. Please use kde_kwargs",
182             UserWarning,
183         )
184     if plot_kwargs:
185         warnings.warn(
186             "plot_kwargs will be deprecated."
187             " Please use scatter_kwargs, kde_kwargs and/or hexbin_kwargs",
188             UserWarning,
189         )
190 
191     if coords is None:
192         coords = {}
193 
194     # Get posterior draws and combine chains
195     dataset = convert_to_dataset(data, group=group)
196     var_names = _var_names(var_names, dataset, filter_vars)
197     plotters = filter_plotters_list(
198         list(xarray_var_iter(get_coords(dataset, coords), var_names=var_names, combined=True)),
199         "plot_pair",
200     )
201     flat_var_names = [plotter[0] for plotter in plotters]
202 
203     divergent_data = None
204     diverging_mask = None
205 
206     # Assigning divergence group based on group param
207     if group == "posterior":
208         divergent_group = "sample_stats"
209     elif group == "prior":
210         divergent_group = "sample_stats_prior"
211     else:
212         divergences = False
213 
214     # Get diverging draws and combine chains
215     if divergences:
216         if hasattr(data, divergent_group) and hasattr(getattr(data, divergent_group), "diverging"):
217             divergent_data = convert_to_dataset(data, group=divergent_group)
218             _, diverging_mask = xarray_to_ndarray(
219                 divergent_data, var_names=("diverging",), combined=True
220             )
221             diverging_mask = np.squeeze(diverging_mask)
222         else:
223             divergences = False
224             warnings.warn(
225                 "Divergences data not found, plotting without divergences. "
226                 "Make sure the sample method provides divergences data and "
227                 "that it is present in the `diverging` field of `sample_stats` "
228                 "or `sample_stats_prior` or set divergences=False",
229                 UserWarning,
230             )
231 
232     if gridsize == "auto":
233         gridsize = int(dataset.dims["draw"] ** 0.35)
234 
235     numvars = len(flat_var_names)
236 
237     if numvars < 2:
238         raise ValueError("Number of variables to be plotted must be 2 or greater.")
239 
240     pairplot_kwargs = dict(
241         ax=ax,
242         plotters=plotters,
243         numvars=numvars,
244         figsize=figsize,
245         textsize=textsize,
246         kind=kind,
247         scatter_kwargs=scatter_kwargs,
248         kde_kwargs=kde_kwargs,
249         hexbin_kwargs=hexbin_kwargs,
250         gridsize=gridsize,
251         colorbar=colorbar,
252         divergences=divergences,
253         diverging_mask=diverging_mask,
254         divergences_kwargs=divergences_kwargs,
255         flat_var_names=flat_var_names,
256         backend_kwargs=backend_kwargs,
257         marginal_kwargs=marginal_kwargs,
258         show=show,
259         marginals=marginals,
260         point_estimate=point_estimate,
261         point_estimate_kwargs=point_estimate_kwargs,
262         point_estimate_marker_kwargs=point_estimate_marker_kwargs,
263         reference_values=reference_values,
264         reference_values_kwargs=reference_values_kwargs,
265     )
266 
267     if backend is None:
268         backend = rcParams["plot.backend"]
269     backend = backend.lower()
270 
271     # TODO: Add backend kwargs
272     plot = get_plotting_function("plot_pair", "pairplot", backend)
273     ax = plot(**pairplot_kwargs)
274     return ax
275
```
--- 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/pairplot.py b/arviz/plots/pairplot.py
--- a/arviz/plots/pairplot.py
+++ b/arviz/plots/pairplot.py
@@ -10,8 +10,8 @@
 from .plot_utils import (
     get_plotting_function,
     xarray_to_ndarray,
-    filter_plotters_list,
     xarray_var_iter,
+    make_label,
 )
 
 
@@ -194,11 +194,10 @@
     # Get posterior draws and combine chains
     dataset = convert_to_dataset(data, group=group)
     var_names = _var_names(var_names, dataset, filter_vars)
-    plotters = filter_plotters_list(
-        list(xarray_var_iter(get_coords(dataset, coords), var_names=var_names, combined=True)),
-        "plot_pair",
+    plotters = list(
+        xarray_var_iter(get_coords(dataset, coords), var_names=var_names, combined=True)
     )
-    flat_var_names = [plotter[0] for plotter in plotters]
+    flat_var_names = [make_label(var_name, selection) for var_name, selection, _ in plotters]
 
     divergent_data = None
     diverging_mask = None

{"golden_diff": "diff --git a/arviz/plots/pairplot.py b/arviz/plots/pairplot.py\n--- a/arviz/plots/pairplot.py\n+++ b/arviz/plots/pairplot.py\n@@ -10,8 +10,8 @@\n from .plot_utils import (\n     get_plotting_function,\n     xarray_to_ndarray,\n-    filter_plotters_list,\n     xarray_var_iter,\n+    make_label,\n )\n \n \n@@ -194,11 +194,10 @@\n     # Get posterior draws and combine chains\n     dataset = convert_to_dataset(data, group=group)\n     var_names = _var_names(var_names, dataset, filter_vars)\n-    plotters = filter_plotters_list(\n-        list(xarray_var_iter(get_coords(dataset, coords), var_names=var_names, combined=True)),\n-        \"plot_pair\",\n+    plotters = list(\n+        xarray_var_iter(get_coords(dataset, coords), var_names=var_names, combined=True)\n     )\n-    flat_var_names = [plotter[0] for plotter in plotters]\n+    flat_var_names = [make_label(var_name, selection) for var_name, selection, _ in plotters]\n \n     divergent_data = None\n     diverging_mask = None\n", "issue": "plot_pair axis labels no longer include coords\n**Describe the bug**\r\nUsing `plot_pair` with a selection of `coords`, I got a plot where the axis labels only show `var_names`, so different `coords` get the same label.\r\n\r\n**To Reproduce**\r\n```\r\ntest_idata = arviz.from_dict(\r\n    posterior = dict(a=numpy.random.rand(1, 10, 3), b=numpy.random.rand(1 ,10, 1)),\r\n    dims={'a':['a_dim',]},\r\n    coords=dict(a_dim=['test_A', 'test_B', 'test_C'])\r\n)\r\narviz.plot_pair(\r\n    test_idata, \r\n    coords=dict(a_dim=['test_A', 'test_B']),\r\n    kind='kde'\r\n);\r\n```\r\n\r\n![grafik](https://user-images.githubusercontent.com/45510988/106592082-56527b80-654f-11eb-95ed-c9041188c4c0.png)\r\n\r\n\r\n**Expected behavior**\r\nAxis labels should also include the `coords` to be unique (in this case a_test_A or similar).\r\n\r\n**Additional context**\r\narviz_version : 0.11.0\r\n\n", "before_files": [{"content": "\"\"\"Plot a scatter, kde and/or hexbin of sampled parameters.\"\"\"\nimport warnings\nfrom typing import List, Optional, Union\n\nimport numpy as np\n\nfrom ..data import convert_to_dataset\nfrom ..rcparams import rcParams\nfrom ..utils import _var_names, get_coords\nfrom .plot_utils import (\n    get_plotting_function,\n    xarray_to_ndarray,\n    filter_plotters_list,\n    xarray_var_iter,\n)\n\n\ndef plot_pair(\n    data,\n    group=\"posterior\",\n    var_names: Optional[List[str]] = None,\n    filter_vars: Optional[str] = None,\n    coords=None,\n    marginals=False,\n    figsize=None,\n    textsize=None,\n    kind: Union[str, List[str]] = \"scatter\",\n    gridsize=\"auto\",\n    contour: Optional[bool] = None,\n    plot_kwargs=None,\n    fill_last=False,\n    divergences=False,\n    colorbar=False,\n    ax=None,\n    divergences_kwargs=None,\n    scatter_kwargs=None,\n    kde_kwargs=None,\n    hexbin_kwargs=None,\n    backend=None,\n    backend_kwargs=None,\n    marginal_kwargs=None,\n    point_estimate=None,\n    point_estimate_kwargs=None,\n    point_estimate_marker_kwargs=None,\n    reference_values=None,\n    reference_values_kwargs=None,\n    show=None,\n):\n    \"\"\"\n    Plot a scatter, kde and/or hexbin matrix with (optional) marginals on the diagonal.\n\n    Parameters\n    ----------\n    data: obj\n        Any object that can be converted to an az.InferenceData object\n        Refer to documentation of az.convert_to_dataset for details\n    group: str, optional\n        Specifies which InferenceData group should be plotted.  Defaults to 'posterior'.\n    var_names: list of variable names, optional\n        Variables to be plotted, if None all variable are plotted. Prefix the\n        variables by `~` when you want to exclude them from the plot.\n    filter_vars: {None, \"like\", \"regex\"}, optional, default=None\n        If `None` (default), interpret var_names as the real variables names. If \"like\",\n        interpret var_names as substrings of the real variables names. If \"regex\",\n        interpret var_names as regular expressions on the real variables names. A la\n        `pandas.filter`.\n    coords: mapping, optional\n        Coordinates of var_names to be plotted. Passed to `Dataset.sel`\n    marginals: bool, optional\n        If True pairplot will include marginal distributions for every variable\n    figsize: figure size tuple\n        If None, size is (8 + numvars, 8 + numvars)\n    textsize: int\n        Text size for labels. If None it will be autoscaled based on figsize.\n    kind : str or List[str]\n        Type of plot to display (scatter, kde and/or hexbin)\n    gridsize: int or (int, int), optional\n        Only works for kind=hexbin.\n        The number of hexagons in the x-direction. The corresponding number of hexagons in the\n        y-direction is chosen such that the hexagons are approximately regular.\n        Alternatively, gridsize can be a tuple with two elements specifying the number of hexagons\n        in the x-direction and the y-direction.\n    contour : bool, optional, deprecated, Defaults to True.\n        If True plot the 2D KDE using contours, otherwise plot a smooth 2D KDE. Defaults to True.\n        **Note:** this default is implemented in the body of the code, not in argument processing.\n    fill_last : bool\n        If True fill the last contour of the 2D KDE plot. Defaults to True.\n    divergences: Boolean\n        If True divergences will be plotted in a different color, only if group is either 'prior'\n        or 'posterior'.\n    colorbar: bool\n        If True a colorbar will be included as part of the plot (Defaults to False).\n        Only works when kind=hexbin\n    ax: axes, optional\n        Matplotlib axes or bokeh figures.\n    divergences_kwargs: dicts, optional\n        Additional keywords passed to ax.scatter for divergences\n    scatter_kwargs:\n        Additional keywords passed to ax.plot when using scatter kind\n    kde_kwargs: dict, optional\n        Additional keywords passed to az.plot_kde when using kde kind\n    hexbin_kwargs: dict, optional\n        Additional keywords passed to ax.hexbin when using hexbin kind\n    backend: str, optional\n        Select plotting backend {\"matplotlib\",\"bokeh\"}. Default \"matplotlib\".\n    backend_kwargs: bool, optional\n        These are kwargs specific to the backend being used. For additional documentation\n        check the plotting method of the backend.\n    marginal_kwargs: dict, optional\n        Additional keywords passed to az.plot_dist, modifying the marginal distributions\n        plotted in the diagonal.\n    point_estimate: str, optional\n        Select point estimate from 'mean', 'mode' or 'median'. The point estimate will be\n        plotted using a scatter marker and vertical/horizontal lines.\n    point_estimate_kwargs: dict, optional\n        Additional keywords passed to ax.vline, ax.hline (matplotlib) or ax.square, Span (bokeh)\n    point_estimate_marker_kwargs: dict, optional\n        Additional keywords passed to ax.scatter in point estimate plot. Not available in bokeh\n    reference_values: dict, optional\n        Reference values for the plotted variables. The Reference values will be plotted\n        using a scatter marker\n    reference_values_kwargs: dict, optional\n        Additional keywords passed to ax.plot or ax.circle in reference values plot\n    show: bool, optional\n        Call backend show function.\n\n    Returns\n    -------\n    axes: matplotlib axes or bokeh figures\n\n    Examples\n    --------\n    KDE Pair Plot\n\n    .. plot::\n        :context: close-figs\n\n        >>> import arviz as az\n        >>> centered = az.load_arviz_data('centered_eight')\n        >>> coords = {'school': ['Choate', 'Deerfield']}\n        >>> az.plot_pair(centered,\n        >>>             var_names=['theta', 'mu', 'tau'],\n        >>>             kind='kde',\n        >>>             coords=coords,\n        >>>             divergences=True,\n        >>>             textsize=18)\n\n    Hexbin pair plot\n\n    .. plot::\n        :context: close-figs\n\n        >>> az.plot_pair(centered,\n        >>>             var_names=['theta', 'mu'],\n        >>>             coords=coords,\n        >>>             textsize=18,\n        >>>             kind='hexbin')\n\n    Pair plot showing divergences and select variables with regular expressions\n\n    .. plot::\n        :context: close-figs\n\n        >>> az.plot_pair(centered,\n        ...             var_names=['^t', 'mu'],\n        ...             filter_vars=\"regex\",\n        ...             coords=coords,\n        ...             divergences=True,\n        ...             textsize=18)\n    \"\"\"\n    valid_kinds = [\"scatter\", \"kde\", \"hexbin\"]\n    kind_boolean: Union[bool, List[bool]]\n    if isinstance(kind, str):\n        kind_boolean = kind in valid_kinds\n    else:\n        kind_boolean = [kind[i] in valid_kinds for i in range(len(kind))]\n    if not np.all(kind_boolean):\n        raise ValueError((f\"Plot type {kind} not recognized.\" \"Plot type must be in {valid_kinds}\"))\n    if fill_last or contour:\n        warnings.warn(\n            \"fill_last and contour will be deprecated. Please use kde_kwargs\",\n            UserWarning,\n        )\n    if plot_kwargs:\n        warnings.warn(\n            \"plot_kwargs will be deprecated.\"\n            \" Please use scatter_kwargs, kde_kwargs and/or hexbin_kwargs\",\n            UserWarning,\n        )\n\n    if coords is None:\n        coords = {}\n\n    # Get posterior draws and combine chains\n    dataset = convert_to_dataset(data, group=group)\n    var_names = _var_names(var_names, dataset, filter_vars)\n    plotters = filter_plotters_list(\n        list(xarray_var_iter(get_coords(dataset, coords), var_names=var_names, combined=True)),\n        \"plot_pair\",\n    )\n    flat_var_names = [plotter[0] for plotter in plotters]\n\n    divergent_data = None\n    diverging_mask = None\n\n    # Assigning divergence group based on group param\n    if group == \"posterior\":\n        divergent_group = \"sample_stats\"\n    elif group == \"prior\":\n        divergent_group = \"sample_stats_prior\"\n    else:\n        divergences = False\n\n    # Get diverging draws and combine chains\n    if divergences:\n        if hasattr(data, divergent_group) and hasattr(getattr(data, divergent_group), \"diverging\"):\n            divergent_data = convert_to_dataset(data, group=divergent_group)\n            _, diverging_mask = xarray_to_ndarray(\n                divergent_data, var_names=(\"diverging\",), combined=True\n            )\n            diverging_mask = np.squeeze(diverging_mask)\n        else:\n            divergences = False\n            warnings.warn(\n                \"Divergences data not found, plotting without divergences. \"\n                \"Make sure the sample method provides divergences data and \"\n                \"that it is present in the `diverging` field of `sample_stats` \"\n                \"or `sample_stats_prior` or set divergences=False\",\n                UserWarning,\n            )\n\n    if gridsize == \"auto\":\n        gridsize = int(dataset.dims[\"draw\"] ** 0.35)\n\n    numvars = len(flat_var_names)\n\n    if numvars < 2:\n        raise ValueError(\"Number of variables to be plotted must be 2 or greater.\")\n\n    pairplot_kwargs = dict(\n        ax=ax,\n        plotters=plotters,\n        numvars=numvars,\n        figsize=figsize,\n        textsize=textsize,\n        kind=kind,\n        scatter_kwargs=scatter_kwargs,\n        kde_kwargs=kde_kwargs,\n        hexbin_kwargs=hexbin_kwargs,\n        gridsize=gridsize,\n        colorbar=colorbar,\n        divergences=divergences,\n        diverging_mask=diverging_mask,\n        divergences_kwargs=divergences_kwargs,\n        flat_var_names=flat_var_names,\n        backend_kwargs=backend_kwargs,\n        marginal_kwargs=marginal_kwargs,\n        show=show,\n        marginals=marginals,\n        point_estimate=point_estimate,\n        point_estimate_kwargs=point_estimate_kwargs,\n        point_estimate_marker_kwargs=point_estimate_marker_kwargs,\n        reference_values=reference_values,\n        reference_values_kwargs=reference_values_kwargs,\n    )\n\n    if backend is None:\n        backend = rcParams[\"plot.backend\"]\n    backend = backend.lower()\n\n    # TODO: Add backend kwargs\n    plot = get_plotting_function(\"plot_pair\", \"pairplot\", backend)\n    ax = plot(**pairplot_kwargs)\n    return ax\n", "path": "arviz/plots/pairplot.py"}], "after_files": [{"content": "\"\"\"Plot a scatter, kde and/or hexbin of sampled parameters.\"\"\"\nimport warnings\nfrom typing import List, Optional, Union\n\nimport numpy as np\n\nfrom ..data import convert_to_dataset\nfrom ..rcparams import rcParams\nfrom ..utils import _var_names, get_coords\nfrom .plot_utils import (\n    get_plotting_function,\n    xarray_to_ndarray,\n    xarray_var_iter,\n    make_label,\n)\n\n\ndef plot_pair(\n    data,\n    group=\"posterior\",\n    var_names: Optional[List[str]] = None,\n    filter_vars: Optional[str] = None,\n    coords=None,\n    marginals=False,\n    figsize=None,\n    textsize=None,\n    kind: Union[str, List[str]] = \"scatter\",\n    gridsize=\"auto\",\n    contour: Optional[bool] = None,\n    plot_kwargs=None,\n    fill_last=False,\n    divergences=False,\n    colorbar=False,\n    ax=None,\n    divergences_kwargs=None,\n    scatter_kwargs=None,\n    kde_kwargs=None,\n    hexbin_kwargs=None,\n    backend=None,\n    backend_kwargs=None,\n    marginal_kwargs=None,\n    point_estimate=None,\n    point_estimate_kwargs=None,\n    point_estimate_marker_kwargs=None,\n    reference_values=None,\n    reference_values_kwargs=None,\n    show=None,\n):\n    \"\"\"\n    Plot a scatter, kde and/or hexbin matrix with (optional) marginals on the diagonal.\n\n    Parameters\n    ----------\n    data: obj\n        Any object that can be converted to an az.InferenceData object\n        Refer to documentation of az.convert_to_dataset for details\n    group: str, optional\n        Specifies which InferenceData group should be plotted.  Defaults to 'posterior'.\n    var_names: list of variable names, optional\n        Variables to be plotted, if None all variable are plotted. Prefix the\n        variables by `~` when you want to exclude them from the plot.\n    filter_vars: {None, \"like\", \"regex\"}, optional, default=None\n        If `None` (default), interpret var_names as the real variables names. If \"like\",\n        interpret var_names as substrings of the real variables names. If \"regex\",\n        interpret var_names as regular expressions on the real variables names. A la\n        `pandas.filter`.\n    coords: mapping, optional\n        Coordinates of var_names to be plotted. Passed to `Dataset.sel`\n    marginals: bool, optional\n        If True pairplot will include marginal distributions for every variable\n    figsize: figure size tuple\n        If None, size is (8 + numvars, 8 + numvars)\n    textsize: int\n        Text size for labels. If None it will be autoscaled based on figsize.\n    kind : str or List[str]\n        Type of plot to display (scatter, kde and/or hexbin)\n    gridsize: int or (int, int), optional\n        Only works for kind=hexbin.\n        The number of hexagons in the x-direction. The corresponding number of hexagons in the\n        y-direction is chosen such that the hexagons are approximately regular.\n        Alternatively, gridsize can be a tuple with two elements specifying the number of hexagons\n        in the x-direction and the y-direction.\n    contour : bool, optional, deprecated, Defaults to True.\n        If True plot the 2D KDE using contours, otherwise plot a smooth 2D KDE. Defaults to True.\n        **Note:** this default is implemented in the body of the code, not in argument processing.\n    fill_last : bool\n        If True fill the last contour of the 2D KDE plot. Defaults to True.\n    divergences: Boolean\n        If True divergences will be plotted in a different color, only if group is either 'prior'\n        or 'posterior'.\n    colorbar: bool\n        If True a colorbar will be included as part of the plot (Defaults to False).\n        Only works when kind=hexbin\n    ax: axes, optional\n        Matplotlib axes or bokeh figures.\n    divergences_kwargs: dicts, optional\n        Additional keywords passed to ax.scatter for divergences\n    scatter_kwargs:\n        Additional keywords passed to ax.plot when using scatter kind\n    kde_kwargs: dict, optional\n        Additional keywords passed to az.plot_kde when using kde kind\n    hexbin_kwargs: dict, optional\n        Additional keywords passed to ax.hexbin when using hexbin kind\n    backend: str, optional\n        Select plotting backend {\"matplotlib\",\"bokeh\"}. Default \"matplotlib\".\n    backend_kwargs: bool, optional\n        These are kwargs specific to the backend being used. For additional documentation\n        check the plotting method of the backend.\n    marginal_kwargs: dict, optional\n        Additional keywords passed to az.plot_dist, modifying the marginal distributions\n        plotted in the diagonal.\n    point_estimate: str, optional\n        Select point estimate from 'mean', 'mode' or 'median'. The point estimate will be\n        plotted using a scatter marker and vertical/horizontal lines.\n    point_estimate_kwargs: dict, optional\n        Additional keywords passed to ax.vline, ax.hline (matplotlib) or ax.square, Span (bokeh)\n    point_estimate_marker_kwargs: dict, optional\n        Additional keywords passed to ax.scatter in point estimate plot. Not available in bokeh\n    reference_values: dict, optional\n        Reference values for the plotted variables. The Reference values will be plotted\n        using a scatter marker\n    reference_values_kwargs: dict, optional\n        Additional keywords passed to ax.plot or ax.circle in reference values plot\n    show: bool, optional\n        Call backend show function.\n\n    Returns\n    -------\n    axes: matplotlib axes or bokeh figures\n\n    Examples\n    --------\n    KDE Pair Plot\n\n    .. plot::\n        :context: close-figs\n\n        >>> import arviz as az\n        >>> centered = az.load_arviz_data('centered_eight')\n        >>> coords = {'school': ['Choate', 'Deerfield']}\n        >>> az.plot_pair(centered,\n        >>>             var_names=['theta', 'mu', 'tau'],\n        >>>             kind='kde',\n        >>>             coords=coords,\n        >>>             divergences=True,\n        >>>             textsize=18)\n\n    Hexbin pair plot\n\n    .. plot::\n        :context: close-figs\n\n        >>> az.plot_pair(centered,\n        >>>             var_names=['theta', 'mu'],\n        >>>             coords=coords,\n        >>>             textsize=18,\n        >>>             kind='hexbin')\n\n    Pair plot showing divergences and select variables with regular expressions\n\n    .. plot::\n        :context: close-figs\n\n        >>> az.plot_pair(centered,\n        ...             var_names=['^t', 'mu'],\n        ...             filter_vars=\"regex\",\n        ...             coords=coords,\n        ...             divergences=True,\n        ...             textsize=18)\n    \"\"\"\n    valid_kinds = [\"scatter\", \"kde\", \"hexbin\"]\n    kind_boolean: Union[bool, List[bool]]\n    if isinstance(kind, str):\n        kind_boolean = kind in valid_kinds\n    else:\n        kind_boolean = [kind[i] in valid_kinds for i in range(len(kind))]\n    if not np.all(kind_boolean):\n        raise ValueError((f\"Plot type {kind} not recognized.\" \"Plot type must be in {valid_kinds}\"))\n    if fill_last or contour:\n        warnings.warn(\n            \"fill_last and contour will be deprecated. Please use kde_kwargs\",\n            UserWarning,\n        )\n    if plot_kwargs:\n        warnings.warn(\n            \"plot_kwargs will be deprecated.\"\n            \" Please use scatter_kwargs, kde_kwargs and/or hexbin_kwargs\",\n            UserWarning,\n        )\n\n    if coords is None:\n        coords = {}\n\n    # Get posterior draws and combine chains\n    dataset = convert_to_dataset(data, group=group)\n    var_names = _var_names(var_names, dataset, filter_vars)\n    plotters = list(\n        xarray_var_iter(get_coords(dataset, coords), var_names=var_names, combined=True)\n    )\n    flat_var_names = [make_label(var_name, selection) for var_name, selection, _ in plotters]\n\n    divergent_data = None\n    diverging_mask = None\n\n    # Assigning divergence group based on group param\n    if group == \"posterior\":\n        divergent_group = \"sample_stats\"\n    elif group == \"prior\":\n        divergent_group = \"sample_stats_prior\"\n    else:\n        divergences = False\n\n    # Get diverging draws and combine chains\n    if divergences:\n        if hasattr(data, divergent_group) and hasattr(getattr(data, divergent_group), \"diverging\"):\n            divergent_data = convert_to_dataset(data, group=divergent_group)\n            _, diverging_mask = xarray_to_ndarray(\n                divergent_data, var_names=(\"diverging\",), combined=True\n            )\n            diverging_mask = np.squeeze(diverging_mask)\n        else:\n            divergences = False\n            warnings.warn(\n                \"Divergences data not found, plotting without divergences. \"\n                \"Make sure the sample method provides divergences data and \"\n                \"that it is present in the `diverging` field of `sample_stats` \"\n                \"or `sample_stats_prior` or set divergences=False\",\n                UserWarning,\n            )\n\n    if gridsize == \"auto\":\n        gridsize = int(dataset.dims[\"draw\"] ** 0.35)\n\n    numvars = len(flat_var_names)\n\n    if numvars < 2:\n        raise ValueError(\"Number of variables to be plotted must be 2 or greater.\")\n\n    pairplot_kwargs = dict(\n        ax=ax,\n        plotters=plotters,\n        numvars=numvars,\n        figsize=figsize,\n        textsize=textsize,\n        kind=kind,\n        scatter_kwargs=scatter_kwargs,\n        kde_kwargs=kde_kwargs,\n        hexbin_kwargs=hexbin_kwargs,\n        gridsize=gridsize,\n        colorbar=colorbar,\n        divergences=divergences,\n        diverging_mask=diverging_mask,\n        divergences_kwargs=divergences_kwargs,\n        flat_var_names=flat_var_names,\n        backend_kwargs=backend_kwargs,\n        marginal_kwargs=marginal_kwargs,\n        show=show,\n        marginals=marginals,\n        point_estimate=point_estimate,\n        point_estimate_kwargs=point_estimate_kwargs,\n        point_estimate_marker_kwargs=point_estimate_marker_kwargs,\n        reference_values=reference_values,\n        reference_values_kwargs=reference_values_kwargs,\n    )\n\n    if backend is None:\n        backend = rcParams[\"plot.backend\"]\n    backend = backend.lower()\n\n    # TODO: Add backend kwargs\n    plot = get_plotting_function(\"plot_pair\", \"pairplot\", backend)\n    ax = plot(**pairplot_kwargs)\n    return ax\n", "path": "arviz/plots/pairplot.py"}]}