We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Remove deprecated arguments from `plot_pair()`
`plot_kwargs` is an argument of `plot_pair()` yet it is not described in the [documentation](https://python.arviz.org/en/latest/api/generated/arviz.plot_pair.html#arviz.plot_pair) for this function.

**To Reproduce**
Go to the link and search for the description of `plot_kwargs`

**Expected behavior**
A complete docstring were `plot_kwargs` usage and behaviour is described.



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

{"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@@ -24,9 +24,6 @@\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     labeller=None,\n@@ -82,11 +79,6 @@\n         such that the hexagons are approximately regular. Alternatively, gridsize\n         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@@ -188,17 +180,6 @@\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", "issue": "Remove deprecated arguments from `plot_pair()`\n`plot_kwargs` is an argument of `plot_pair()` yet it is not described in the [documentation](https://python.arviz.org/en/latest/api/generated/arviz.plot_pair.html#arviz.plot_pair) for this function.\r\n\r\n**To Reproduce**\r\nGo to the link and search for the description of `plot_kwargs`\r\n\r\n**Expected behavior**\r\nA complete docstring were `plot_kwargs` usage and behaviour is described.\r\n\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 ..labels import BaseLabeller\nfrom ..sel_utils import xarray_to_ndarray, xarray_var_iter\nfrom .plot_utils import get_plotting_function\nfrom ..rcparams import rcParams\nfrom ..utils import _var_names, get_coords\n\n\ndef plot_pair(\n    data,\n    group=\"posterior\",\n    var_names: Optional[List[str]] = None,\n    filter_vars: Optional[str] = None,\n    combine_dims=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    labeller=None,\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 :class:`arviz.InferenceData` object.\n        Refer to documentation of :func:`arviz.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    combine_dims : set_like of str, optional\n        List of dimensions to reduce. Defaults to reducing only the \"chain\" and \"draw\" dimensions.\n        See the :ref:`this section <common_combine_dims>` for usage examples.\n    coords: mapping, optional\n        Coordinates of var_names to be plotted. Passed to :meth:`xarray.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``. The number of hexagons in the x-direction.\n        The corresponding number of hexagons in the y-direction is chosen\n        such that the hexagons are approximately regular. Alternatively, gridsize\n        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    labeller : labeller instance, optional\n        Class providing the method ``make_label_vert`` to generate the labels in the plot.\n        Read the :ref:`label_guide` for more details and usage examples.\n    ax: axes, optional\n        Matplotlib axes or bokeh figures.\n    divergences_kwargs: dicts, optional\n        Additional keywords passed to :meth:`matplotlib.axes.Axes.scatter` for divergences\n    scatter_kwargs:\n        Additional keywords passed to :meth:`matplotlib.axes.Axes.scatter` when using scatter kind\n    kde_kwargs: dict, optional\n        Additional keywords passed to :func:`arviz.plot_kde` when using kde kind\n    hexbin_kwargs: dict, optional\n        Additional keywords passed to :meth:`matplotlib.axes.Axes.hexbin` when\n        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, passed to\n        :func:`matplotlib.pyplot.subplots` or\n        :func:`bokeh.plotting.figure`.\n    marginal_kwargs: dict, optional\n        Additional keywords passed to :func:`arviz.plot_dist`, modifying the\n        marginal distributions 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 :meth:`matplotlib.axes.Axes.axvline`,\n        :meth:`matplotlib.axes.Axes.axhline` (matplotlib) or\n        :class:`bokeh:bokeh.models.Span` (bokeh)\n    point_estimate_marker_kwargs: dict, optional\n        Additional keywords passed to :meth:`matplotlib.axes.Axes.scatter`\n        or :meth:`bokeh:bokeh.plotting.Figure.square` in point\n        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 :meth:`matplotlib.axes.Axes.plot` or\n        :meth:`bokeh:bokeh.plotting.Figure.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    if labeller is None:\n        labeller = BaseLabeller()\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(\n            get_coords(dataset, coords), var_names=var_names, skip_dims=combine_dims, combined=True\n        )\n    )\n    flat_var_names = [\n        labeller.make_label_vert(var_name, sel, isel) for var_name, sel, isel, _ in plotters\n    ]\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 ..labels import BaseLabeller\nfrom ..sel_utils import xarray_to_ndarray, xarray_var_iter\nfrom .plot_utils import get_plotting_function\nfrom ..rcparams import rcParams\nfrom ..utils import _var_names, get_coords\n\n\ndef plot_pair(\n    data,\n    group=\"posterior\",\n    var_names: Optional[List[str]] = None,\n    filter_vars: Optional[str] = None,\n    combine_dims=None,\n    coords=None,\n    marginals=False,\n    figsize=None,\n    textsize=None,\n    kind: Union[str, List[str]] = \"scatter\",\n    gridsize=\"auto\",\n    divergences=False,\n    colorbar=False,\n    labeller=None,\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 :class:`arviz.InferenceData` object.\n        Refer to documentation of :func:`arviz.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    combine_dims : set_like of str, optional\n        List of dimensions to reduce. Defaults to reducing only the \"chain\" and \"draw\" dimensions.\n        See the :ref:`this section <common_combine_dims>` for usage examples.\n    coords: mapping, optional\n        Coordinates of var_names to be plotted. Passed to :meth:`xarray.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``. The number of hexagons in the x-direction.\n        The corresponding number of hexagons in the y-direction is chosen\n        such that the hexagons are approximately regular. Alternatively, gridsize\n        can be a tuple with two elements specifying the number of hexagons\n        in the x-direction and the y-direction.\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    labeller : labeller instance, optional\n        Class providing the method ``make_label_vert`` to generate the labels in the plot.\n        Read the :ref:`label_guide` for more details and usage examples.\n    ax: axes, optional\n        Matplotlib axes or bokeh figures.\n    divergences_kwargs: dicts, optional\n        Additional keywords passed to :meth:`matplotlib.axes.Axes.scatter` for divergences\n    scatter_kwargs:\n        Additional keywords passed to :meth:`matplotlib.axes.Axes.scatter` when using scatter kind\n    kde_kwargs: dict, optional\n        Additional keywords passed to :func:`arviz.plot_kde` when using kde kind\n    hexbin_kwargs: dict, optional\n        Additional keywords passed to :meth:`matplotlib.axes.Axes.hexbin` when\n        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, passed to\n        :func:`matplotlib.pyplot.subplots` or\n        :func:`bokeh.plotting.figure`.\n    marginal_kwargs: dict, optional\n        Additional keywords passed to :func:`arviz.plot_dist`, modifying the\n        marginal distributions 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 :meth:`matplotlib.axes.Axes.axvline`,\n        :meth:`matplotlib.axes.Axes.axhline` (matplotlib) or\n        :class:`bokeh:bokeh.models.Span` (bokeh)\n    point_estimate_marker_kwargs: dict, optional\n        Additional keywords passed to :meth:`matplotlib.axes.Axes.scatter`\n        or :meth:`bokeh:bokeh.plotting.Figure.square` in point\n        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 :meth:`matplotlib.axes.Axes.plot` or\n        :meth:`bokeh:bokeh.plotting.Figure.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\n    if coords is None:\n        coords = {}\n\n    if labeller is None:\n        labeller = BaseLabeller()\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(\n            get_coords(dataset, coords), var_names=var_names, skip_dims=combine_dims, combined=True\n        )\n    )\n    flat_var_names = [\n        labeller.make_label_vert(var_name, sel, isel) for var_name, sel, isel, _ in plotters\n    ]\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"}]}