We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add docs references to plot_parallel docstring
Add links to the related functions and classes to all the places where they are mentioned in the [plot_parallel](https://arviz-devs.github.io/arviz/api/generated/arviz.plot_parallel.html) docstring.

## Sample PR:
You can see https://github.com/arviz-devs/arviz/pull/1816 for the function, `plot_autocorr`. 

## Source File
Source file: https://github.com/arviz-devs/arviz/blob/main/arviz/plots/parallelplot.py

## How to add links
Add the links in the docstring of doc. You can also check the docstring by going to the `[source]`. 

* Add links to the ArviZ functions and classes using [Cross-referencing with Sphinx](https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html).
* Add links to the xarray functions and classes using [Intersphinx](https://docs.readthedocs.io/en/stable/guides/intersphinx.html).
* Add the rest of the external links using this [syntax](https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html#links-to-external-web-pages).

## `backend_kwargs` and `kwargs`
For adding `backend_kwargs` as they have been added in #1816, see [Adding backend_kwargs guide](https://github.com/arviz-devs/arviz/wiki/ArviZ-Hacktoberfest-2021#adding-backend_kwargs). 


## See also section
Add the following functions in the "See also" section:
1. [plot_pair](https://arviz-devs.github.io/arviz/api/generated/arviz.plot_pair.html)
2. [plot_trace](https://arviz-devs.github.io/arviz/api/generated/arviz.plot_trace.html)


See [Adding "see also" section](https://github.com/arviz-devs/arviz/wiki/ArviZ-Hacktoberfest-2021#adding-see-also-section) for more details. 

## Checking the preview of docs
For checking the preview of docs, you don't need t set up the project on your local machine. Just follow the [checking the preview guide](https://github.com/arviz-devs/arviz/wiki/ArviZ-Hacktoberfest-2021#how-to-check-the-preview-of-docs). 

--- 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/parallelplot.py`
Content:
```
1 """Parallel coordinates plot showing posterior points with and without divergences marked."""
2 import numpy as np
3 from scipy.stats import rankdata
4 
5 from ..data import convert_to_dataset
6 from ..labels import BaseLabeller
7 from ..sel_utils import xarray_to_ndarray
8 from ..rcparams import rcParams
9 from ..stats.stats_utils import stats_variance_2d as svar
10 from ..utils import _numba_var, _var_names, get_coords
11 from .plot_utils import get_plotting_function
12 
13 
14 def plot_parallel(
15     data,
16     var_names=None,
17     filter_vars=None,
18     coords=None,
19     figsize=None,
20     textsize=None,
21     legend=True,
22     colornd="k",
23     colord="C1",
24     shadend=0.025,
25     labeller=None,
26     ax=None,
27     norm_method=None,
28     backend=None,
29     backend_config=None,
30     backend_kwargs=None,
31     show=None,
32 ):
33     """
34     Plot parallel coordinates plot showing posterior points with and without divergences.
35 
36     Described by https://arxiv.org/abs/1709.01449
37 
38     Parameters
39     ----------
40     data: obj
41         Any object that can be converted to an az.InferenceData object
42         Refer to documentation of az.convert_to_dataset for details
43     var_names: list of variable names
44         Variables to be plotted, if `None` all variable are plotted. Can be used to change the order
45         of the plotted variables. Prefix the variables by `~` when you want to exclude
46         them from the plot.
47     filter_vars: {None, "like", "regex"}, optional, default=None
48         If `None` (default), interpret var_names as the real variables names. If "like",
49         interpret var_names as substrings of the real variables names. If "regex",
50         interpret var_names as regular expressions on the real variables names. A la
51         `pandas.filter`.
52     coords: mapping, optional
53         Coordinates of var_names to be plotted. Passed to `Dataset.sel`
54     figsize: tuple
55         Figure size. If None it will be defined automatically.
56     textsize: float
57         Text size scaling factor for labels, titles and lines. If None it will be autoscaled based
58         on figsize.
59     legend: bool
60         Flag for plotting legend (defaults to True)
61     colornd: valid matplotlib color
62         color for non-divergent points. Defaults to 'k'
63     colord: valid matplotlib color
64         color for divergent points. Defaults to 'C1'
65     shadend: float
66         Alpha blending value for non-divergent points, between 0 (invisible) and 1 (opaque).
67         Defaults to .025
68     labeller : labeller instance, optional
69         Class providing the method `make_label_vert` to generate the labels in the plot.
70         Read the :ref:`label_guide` for more details and usage examples.
71     ax: axes, optional
72         Matplotlib axes or bokeh figures.
73     norm_method: str
74         Method for normalizing the data. Methods include normal, minmax and rank.
75         Defaults to none.
76     backend: str, optional
77         Select plotting backend {"matplotlib","bokeh"}. Default "matplotlib".
78     backend_config: dict, optional
79         Currently specifies the bounds to use for bokeh axes. Defaults to value set in rcParams.
80     backend_kwargs: bool, optional
81         These are kwargs specific to the backend being used. For additional documentation
82         check the plotting method of the backend.
83     show: bool, optional
84         Call backend show function.
85 
86     Returns
87     -------
88     axes: matplotlib axes or bokeh figures
89 
90     Examples
91     --------
92     Plot default parallel plot
93 
94     .. plot::
95         :context: close-figs
96 
97         >>> import arviz as az
98         >>> data = az.load_arviz_data('centered_eight')
99         >>> az.plot_parallel(data, var_names=["mu", "tau"])
100 
101 
102     Plot parallel plot with normalization
103 
104     .. plot::
105         :context: close-figs
106 
107         >>> az.plot_parallel(data, var_names=["mu", "tau"], norm_method='normal')
108 
109     """
110     if coords is None:
111         coords = {}
112 
113     if labeller is None:
114         labeller = BaseLabeller()
115 
116     # Get diverging draws and combine chains
117     divergent_data = convert_to_dataset(data, group="sample_stats")
118     _, diverging_mask = xarray_to_ndarray(divergent_data, var_names=("diverging",), combined=True)
119     diverging_mask = np.squeeze(diverging_mask)
120 
121     # Get posterior draws and combine chains
122     posterior_data = convert_to_dataset(data, group="posterior")
123     var_names = _var_names(var_names, posterior_data, filter_vars)
124     var_names, _posterior = xarray_to_ndarray(
125         get_coords(posterior_data, coords),
126         var_names=var_names,
127         combined=True,
128         label_fun=labeller.make_label_vert,
129     )
130     if len(var_names) < 2:
131         raise ValueError("Number of variables to be plotted must be 2 or greater.")
132     if norm_method is not None:
133         if norm_method == "normal":
134             mean = np.mean(_posterior, axis=1)
135             if _posterior.ndim <= 2:
136                 standard_deviation = np.sqrt(_numba_var(svar, np.var, _posterior, axis=1))
137             else:
138                 standard_deviation = np.std(_posterior, axis=1)
139             for i in range(0, np.shape(mean)[0]):
140                 _posterior[i, :] = (_posterior[i, :] - mean[i]) / standard_deviation[i]
141         elif norm_method == "minmax":
142             min_elem = np.min(_posterior, axis=1)
143             max_elem = np.max(_posterior, axis=1)
144             for i in range(0, np.shape(min_elem)[0]):
145                 _posterior[i, :] = ((_posterior[i, :]) - min_elem[i]) / (max_elem[i] - min_elem[i])
146         elif norm_method == "rank":
147             _posterior = rankdata(_posterior, axis=1, method="average")
148         else:
149             raise ValueError(f"{norm_method} is not supported. Use normal, minmax or rank.")
150 
151     parallel_kwargs = dict(
152         ax=ax,
153         colornd=colornd,
154         colord=colord,
155         shadend=shadend,
156         diverging_mask=diverging_mask,
157         posterior=_posterior,
158         textsize=textsize,
159         var_names=var_names,
160         legend=legend,
161         figsize=figsize,
162         backend_kwargs=backend_kwargs,
163         backend_config=backend_config,
164         show=show,
165     )
166 
167     if backend is None:
168         backend = rcParams["plot.backend"]
169     backend = backend.lower()
170 
171     # TODO: Add backend kwargs
172     plot = get_plotting_function("plot_parallel", "parallelplot", backend)
173     ax = plot(**parallel_kwargs)
174 
175     return ax
176
```
--- 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/parallelplot.py b/arviz/plots/parallelplot.py
--- a/arviz/plots/parallelplot.py
+++ b/arviz/plots/parallelplot.py
@@ -38,24 +38,25 @@
     Parameters
     ----------
     data: obj
-        Any object that can be converted to an az.InferenceData object
-        Refer to documentation of az.convert_to_dataset for details
+        Any object that can be converted to an :class:`arviz.InferenceData` object
+        refer to documentation of :func:`arviz.convert_to_dataset` for details
     var_names: list of variable names
-        Variables to be plotted, if `None` all variable are plotted. Can be used to change the order
-        of the plotted variables. Prefix the variables by `~` when you want to exclude
+        Variables to be plotted, if `None` all variables are plotted. Can be used to change the
+        order of the plotted variables. Prefix the variables by ``~`` when you want to exclude
         them from the plot.
     filter_vars: {None, "like", "regex"}, optional, default=None
         If `None` (default), interpret var_names as the real variables names. If "like",
         interpret var_names as substrings of the real variables names. If "regex",
         interpret var_names as regular expressions on the real variables names. A la
-        `pandas.filter`.
+        ``pandas.filter``.
     coords: mapping, optional
-        Coordinates of var_names to be plotted. Passed to `Dataset.sel`
+        Coordinates of ``var_names`` to be plotted.
+        Passed to :meth:`xarray.Dataset.sel`.
     figsize: tuple
         Figure size. If None it will be defined automatically.
     textsize: float
         Text size scaling factor for labels, titles and lines. If None it will be autoscaled based
-        on figsize.
+        on ``figsize``.
     legend: bool
         Flag for plotting legend (defaults to True)
     colornd: valid matplotlib color
@@ -66,7 +67,7 @@
         Alpha blending value for non-divergent points, between 0 (invisible) and 1 (opaque).
         Defaults to .025
     labeller : labeller instance, optional
-        Class providing the method `make_label_vert` to generate the labels in the plot.
+        Class providing the method ``make_label_vert`` to generate the labels in the plot.
         Read the :ref:`label_guide` for more details and usage examples.
     ax: axes, optional
         Matplotlib axes or bokeh figures.
@@ -76,10 +77,12 @@
     backend: str, optional
         Select plotting backend {"matplotlib","bokeh"}. Default "matplotlib".
     backend_config: dict, optional
-        Currently specifies the bounds to use for bokeh axes. Defaults to value set in rcParams.
+        Currently specifies the bounds to use for bokeh axes.
+        Defaults to value set in ``rcParams``.
     backend_kwargs: bool, optional
-        These are kwargs specific to the backend being used. For additional documentation
-        check the plotting method of the backend.
+        These are kwargs specific to the backend being used, passed to
+        :func:`matplotlib.pyplot.subplots` or
+        :func:`bokeh.plotting.figure`.
     show: bool, optional
         Call backend show function.
 
@@ -87,6 +90,12 @@
     -------
     axes: matplotlib axes or bokeh figures
 
+    See Also
+    --------
+    plot_pair : Plot a scatter, kde and/or hexbin matrix with (optional) marginals on the diagonal.
+    plot_trace : Plot distribution (histogram or kernel density estimates) and sampled values
+                 or rank plot
+
     Examples
     --------
     Plot default parallel plot

{"golden_diff": "diff --git a/arviz/plots/parallelplot.py b/arviz/plots/parallelplot.py\n--- a/arviz/plots/parallelplot.py\n+++ b/arviz/plots/parallelplot.py\n@@ -38,24 +38,25 @@\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+        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     var_names: list of variable names\n-        Variables to be plotted, if `None` all variable are plotted. Can be used to change the order\n-        of the plotted variables. Prefix the variables by `~` when you want to exclude\n+        Variables to be plotted, if `None` all variables are plotted. Can be used to change the\n+        order of the plotted variables. Prefix the variables by ``~`` when you want to exclude\n         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+        ``pandas.filter``.\n     coords: mapping, optional\n-        Coordinates of var_names to be plotted. Passed to `Dataset.sel`\n+        Coordinates of ``var_names`` to be plotted.\n+        Passed to :meth:`xarray.Dataset.sel`.\n     figsize: tuple\n         Figure size. If None it will be defined automatically.\n     textsize: float\n         Text size scaling factor for labels, titles and lines. If None it will be autoscaled based\n-        on figsize.\n+        on ``figsize``.\n     legend: bool\n         Flag for plotting legend (defaults to True)\n     colornd: valid matplotlib color\n@@ -66,7 +67,7 @@\n         Alpha blending value for non-divergent points, between 0 (invisible) and 1 (opaque).\n         Defaults to .025\n     labeller : labeller instance, optional\n-        Class providing the method `make_label_vert` to generate the labels in the plot.\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@@ -76,10 +77,12 @@\n     backend: str, optional\n         Select plotting backend {\"matplotlib\",\"bokeh\"}. Default \"matplotlib\".\n     backend_config: dict, optional\n-        Currently specifies the bounds to use for bokeh axes. Defaults to value set in rcParams.\n+        Currently specifies the bounds to use for bokeh axes.\n+        Defaults to value set in ``rcParams``.\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+        These are kwargs specific to the backend being used, passed to\n+        :func:`matplotlib.pyplot.subplots` or\n+        :func:`bokeh.plotting.figure`.\n     show: bool, optional\n         Call backend show function.\n \n@@ -87,6 +90,12 @@\n     -------\n     axes: matplotlib axes or bokeh figures\n \n+    See Also\n+    --------\n+    plot_pair : Plot a scatter, kde and/or hexbin matrix with (optional) marginals on the diagonal.\n+    plot_trace : Plot distribution (histogram or kernel density estimates) and sampled values\n+                 or rank plot\n+\n     Examples\n     --------\n     Plot default parallel plot\n", "issue": "Add docs references to plot_parallel docstring\nAdd links to the related functions and classes to all the places where they are mentioned in the [plot_parallel](https://arviz-devs.github.io/arviz/api/generated/arviz.plot_parallel.html) docstring.\r\n\r\n## Sample PR:\r\nYou can see https://github.com/arviz-devs/arviz/pull/1816 for the function, `plot_autocorr`. \r\n\r\n## Source File\r\nSource file: https://github.com/arviz-devs/arviz/blob/main/arviz/plots/parallelplot.py\r\n\r\n## How to add links\r\nAdd the links in the docstring of doc. You can also check the docstring by going to the `[source]`. \r\n\r\n* Add links to the ArviZ functions and classes using [Cross-referencing with Sphinx](https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html).\r\n* Add links to the xarray functions and classes using [Intersphinx](https://docs.readthedocs.io/en/stable/guides/intersphinx.html).\r\n* Add the rest of the external links using this [syntax](https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html#links-to-external-web-pages).\r\n\r\n## `backend_kwargs` and `kwargs`\r\nFor adding `backend_kwargs` as they have been added in #1816, see [Adding backend_kwargs guide](https://github.com/arviz-devs/arviz/wiki/ArviZ-Hacktoberfest-2021#adding-backend_kwargs). \r\n\r\n\r\n## See also section\r\nAdd the following functions in the \"See also\" section:\r\n1. [plot_pair](https://arviz-devs.github.io/arviz/api/generated/arviz.plot_pair.html)\r\n2. [plot_trace](https://arviz-devs.github.io/arviz/api/generated/arviz.plot_trace.html)\r\n\r\n\r\nSee [Adding \"see also\" section](https://github.com/arviz-devs/arviz/wiki/ArviZ-Hacktoberfest-2021#adding-see-also-section) for more details. \r\n\r\n## Checking the preview of docs\r\nFor checking the preview of docs, you don't need t set up the project on your local machine. Just follow the [checking the preview guide](https://github.com/arviz-devs/arviz/wiki/ArviZ-Hacktoberfest-2021#how-to-check-the-preview-of-docs). \n", "before_files": [{"content": "\"\"\"Parallel coordinates plot showing posterior points with and without divergences marked.\"\"\"\nimport numpy as np\nfrom scipy.stats import rankdata\n\nfrom ..data import convert_to_dataset\nfrom ..labels import BaseLabeller\nfrom ..sel_utils import xarray_to_ndarray\nfrom ..rcparams import rcParams\nfrom ..stats.stats_utils import stats_variance_2d as svar\nfrom ..utils import _numba_var, _var_names, get_coords\nfrom .plot_utils import get_plotting_function\n\n\ndef plot_parallel(\n    data,\n    var_names=None,\n    filter_vars=None,\n    coords=None,\n    figsize=None,\n    textsize=None,\n    legend=True,\n    colornd=\"k\",\n    colord=\"C1\",\n    shadend=0.025,\n    labeller=None,\n    ax=None,\n    norm_method=None,\n    backend=None,\n    backend_config=None,\n    backend_kwargs=None,\n    show=None,\n):\n    \"\"\"\n    Plot parallel coordinates plot showing posterior points with and without divergences.\n\n    Described by https://arxiv.org/abs/1709.01449\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    var_names: list of variable names\n        Variables to be plotted, if `None` all variable are plotted. Can be used to change the order\n        of the plotted variables. Prefix the variables by `~` when you want to exclude\n        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    figsize: tuple\n        Figure size. If None it will be defined automatically.\n    textsize: float\n        Text size scaling factor for labels, titles and lines. If None it will be autoscaled based\n        on figsize.\n    legend: bool\n        Flag for plotting legend (defaults to True)\n    colornd: valid matplotlib color\n        color for non-divergent points. Defaults to 'k'\n    colord: valid matplotlib color\n        color for divergent points. Defaults to 'C1'\n    shadend: float\n        Alpha blending value for non-divergent points, between 0 (invisible) and 1 (opaque).\n        Defaults to .025\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    norm_method: str\n        Method for normalizing the data. Methods include normal, minmax and rank.\n        Defaults to none.\n    backend: str, optional\n        Select plotting backend {\"matplotlib\",\"bokeh\"}. Default \"matplotlib\".\n    backend_config: dict, optional\n        Currently specifies the bounds to use for bokeh axes. Defaults to value set in rcParams.\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    show: bool, optional\n        Call backend show function.\n\n    Returns\n    -------\n    axes: matplotlib axes or bokeh figures\n\n    Examples\n    --------\n    Plot default parallel plot\n\n    .. plot::\n        :context: close-figs\n\n        >>> import arviz as az\n        >>> data = az.load_arviz_data('centered_eight')\n        >>> az.plot_parallel(data, var_names=[\"mu\", \"tau\"])\n\n\n    Plot parallel plot with normalization\n\n    .. plot::\n        :context: close-figs\n\n        >>> az.plot_parallel(data, var_names=[\"mu\", \"tau\"], norm_method='normal')\n\n    \"\"\"\n    if coords is None:\n        coords = {}\n\n    if labeller is None:\n        labeller = BaseLabeller()\n\n    # Get diverging draws and combine chains\n    divergent_data = convert_to_dataset(data, group=\"sample_stats\")\n    _, diverging_mask = xarray_to_ndarray(divergent_data, var_names=(\"diverging\",), combined=True)\n    diverging_mask = np.squeeze(diverging_mask)\n\n    # Get posterior draws and combine chains\n    posterior_data = convert_to_dataset(data, group=\"posterior\")\n    var_names = _var_names(var_names, posterior_data, filter_vars)\n    var_names, _posterior = xarray_to_ndarray(\n        get_coords(posterior_data, coords),\n        var_names=var_names,\n        combined=True,\n        label_fun=labeller.make_label_vert,\n    )\n    if len(var_names) < 2:\n        raise ValueError(\"Number of variables to be plotted must be 2 or greater.\")\n    if norm_method is not None:\n        if norm_method == \"normal\":\n            mean = np.mean(_posterior, axis=1)\n            if _posterior.ndim <= 2:\n                standard_deviation = np.sqrt(_numba_var(svar, np.var, _posterior, axis=1))\n            else:\n                standard_deviation = np.std(_posterior, axis=1)\n            for i in range(0, np.shape(mean)[0]):\n                _posterior[i, :] = (_posterior[i, :] - mean[i]) / standard_deviation[i]\n        elif norm_method == \"minmax\":\n            min_elem = np.min(_posterior, axis=1)\n            max_elem = np.max(_posterior, axis=1)\n            for i in range(0, np.shape(min_elem)[0]):\n                _posterior[i, :] = ((_posterior[i, :]) - min_elem[i]) / (max_elem[i] - min_elem[i])\n        elif norm_method == \"rank\":\n            _posterior = rankdata(_posterior, axis=1, method=\"average\")\n        else:\n            raise ValueError(f\"{norm_method} is not supported. Use normal, minmax or rank.\")\n\n    parallel_kwargs = dict(\n        ax=ax,\n        colornd=colornd,\n        colord=colord,\n        shadend=shadend,\n        diverging_mask=diverging_mask,\n        posterior=_posterior,\n        textsize=textsize,\n        var_names=var_names,\n        legend=legend,\n        figsize=figsize,\n        backend_kwargs=backend_kwargs,\n        backend_config=backend_config,\n        show=show,\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_parallel\", \"parallelplot\", backend)\n    ax = plot(**parallel_kwargs)\n\n    return ax\n", "path": "arviz/plots/parallelplot.py"}], "after_files": [{"content": "\"\"\"Parallel coordinates plot showing posterior points with and without divergences marked.\"\"\"\nimport numpy as np\nfrom scipy.stats import rankdata\n\nfrom ..data import convert_to_dataset\nfrom ..labels import BaseLabeller\nfrom ..sel_utils import xarray_to_ndarray\nfrom ..rcparams import rcParams\nfrom ..stats.stats_utils import stats_variance_2d as svar\nfrom ..utils import _numba_var, _var_names, get_coords\nfrom .plot_utils import get_plotting_function\n\n\ndef plot_parallel(\n    data,\n    var_names=None,\n    filter_vars=None,\n    coords=None,\n    figsize=None,\n    textsize=None,\n    legend=True,\n    colornd=\"k\",\n    colord=\"C1\",\n    shadend=0.025,\n    labeller=None,\n    ax=None,\n    norm_method=None,\n    backend=None,\n    backend_config=None,\n    backend_kwargs=None,\n    show=None,\n):\n    \"\"\"\n    Plot parallel coordinates plot showing posterior points with and without divergences.\n\n    Described by https://arxiv.org/abs/1709.01449\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    var_names: list of variable names\n        Variables to be plotted, if `None` all variables are plotted. Can be used to change the\n        order of the plotted variables. Prefix the variables by ``~`` when you want to exclude\n        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.\n        Passed to :meth:`xarray.Dataset.sel`.\n    figsize: tuple\n        Figure size. If None it will be defined automatically.\n    textsize: float\n        Text size scaling factor for labels, titles and lines. If None it will be autoscaled based\n        on ``figsize``.\n    legend: bool\n        Flag for plotting legend (defaults to True)\n    colornd: valid matplotlib color\n        color for non-divergent points. Defaults to 'k'\n    colord: valid matplotlib color\n        color for divergent points. Defaults to 'C1'\n    shadend: float\n        Alpha blending value for non-divergent points, between 0 (invisible) and 1 (opaque).\n        Defaults to .025\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    norm_method: str\n        Method for normalizing the data. Methods include normal, minmax and rank.\n        Defaults to none.\n    backend: str, optional\n        Select plotting backend {\"matplotlib\",\"bokeh\"}. Default \"matplotlib\".\n    backend_config: dict, optional\n        Currently specifies the bounds to use for bokeh axes.\n        Defaults to value set in ``rcParams``.\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    show: bool, optional\n        Call backend show function.\n\n    Returns\n    -------\n    axes: matplotlib axes or bokeh figures\n\n    See Also\n    --------\n    plot_pair : Plot a scatter, kde and/or hexbin matrix with (optional) marginals on the diagonal.\n    plot_trace : Plot distribution (histogram or kernel density estimates) and sampled values\n                 or rank plot\n\n    Examples\n    --------\n    Plot default parallel plot\n\n    .. plot::\n        :context: close-figs\n\n        >>> import arviz as az\n        >>> data = az.load_arviz_data('centered_eight')\n        >>> az.plot_parallel(data, var_names=[\"mu\", \"tau\"])\n\n\n    Plot parallel plot with normalization\n\n    .. plot::\n        :context: close-figs\n\n        >>> az.plot_parallel(data, var_names=[\"mu\", \"tau\"], norm_method='normal')\n\n    \"\"\"\n    if coords is None:\n        coords = {}\n\n    if labeller is None:\n        labeller = BaseLabeller()\n\n    # Get diverging draws and combine chains\n    divergent_data = convert_to_dataset(data, group=\"sample_stats\")\n    _, diverging_mask = xarray_to_ndarray(divergent_data, var_names=(\"diverging\",), combined=True)\n    diverging_mask = np.squeeze(diverging_mask)\n\n    # Get posterior draws and combine chains\n    posterior_data = convert_to_dataset(data, group=\"posterior\")\n    var_names = _var_names(var_names, posterior_data, filter_vars)\n    var_names, _posterior = xarray_to_ndarray(\n        get_coords(posterior_data, coords),\n        var_names=var_names,\n        combined=True,\n        label_fun=labeller.make_label_vert,\n    )\n    if len(var_names) < 2:\n        raise ValueError(\"Number of variables to be plotted must be 2 or greater.\")\n    if norm_method is not None:\n        if norm_method == \"normal\":\n            mean = np.mean(_posterior, axis=1)\n            if _posterior.ndim <= 2:\n                standard_deviation = np.sqrt(_numba_var(svar, np.var, _posterior, axis=1))\n            else:\n                standard_deviation = np.std(_posterior, axis=1)\n            for i in range(0, np.shape(mean)[0]):\n                _posterior[i, :] = (_posterior[i, :] - mean[i]) / standard_deviation[i]\n        elif norm_method == \"minmax\":\n            min_elem = np.min(_posterior, axis=1)\n            max_elem = np.max(_posterior, axis=1)\n            for i in range(0, np.shape(min_elem)[0]):\n                _posterior[i, :] = ((_posterior[i, :]) - min_elem[i]) / (max_elem[i] - min_elem[i])\n        elif norm_method == \"rank\":\n            _posterior = rankdata(_posterior, axis=1, method=\"average\")\n        else:\n            raise ValueError(f\"{norm_method} is not supported. Use normal, minmax or rank.\")\n\n    parallel_kwargs = dict(\n        ax=ax,\n        colornd=colornd,\n        colord=colord,\n        shadend=shadend,\n        diverging_mask=diverging_mask,\n        posterior=_posterior,\n        textsize=textsize,\n        var_names=var_names,\n        legend=legend,\n        figsize=figsize,\n        backend_kwargs=backend_kwargs,\n        backend_config=backend_config,\n        show=show,\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_parallel\", \"parallelplot\", backend)\n    ax = plot(**parallel_kwargs)\n\n    return ax\n", "path": "arviz/plots/parallelplot.py"}]}