arviz.plot_pair — ArviZ dev documentation (original) (raw)
arviz.plot_pair(data, group='posterior', var_names=None, filter_vars=None, combine_dims=None, coords=None, marginals=False, figsize=None, textsize=None, kind='scatter', gridsize='auto', divergences=False, colorbar=False, labeller=None, ax=None, divergences_kwargs=None, scatter_kwargs=None, kde_kwargs=None, hexbin_kwargs=None, backend=None, backend_kwargs=None, marginal_kwargs=None, point_estimate=None, point_estimate_kwargs=None, point_estimate_marker_kwargs=None, reference_values=None, reference_values_kwargs=None, show=None)[source]#
Plot a scatter, kde and/or hexbin matrix with (optional) marginals on the diagonal.
Parameters:
data: obj
Any object that can be converted to an arviz.InferenceData object. Refer to documentation of arviz.convert_to_dataset() for details
group: str, optional
Specifies which InferenceData group should be plotted. Defaults to ‘posterior’.
var_names: list of variable names, optional
Variables to be plotted, if None all variable are plotted. 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 lapandas.filter
.
combine_dimsset_like
of str, optional
List of dimensions to reduce. Defaults to reducing only the “chain” and “draw” dimensions. See the this section for usage examples.
coords: mapping, optional
Coordinates of var_names to be plotted. Passed to xarray.Dataset.sel().
marginals: bool, optional
If True pairplot will include marginal distributions for every variable
figsize: figure size tuple
If None, size is (8 + numvars, 8 + numvars)
textsize: int
Text size for labels. If None it will be autoscaled based on figsize
.
Type of plot to display (scatter, kde and/or hexbin)
gridsize: int or (int, int), optional
Only works for kind=hexbin
. The number of hexagons in the x-direction. The corresponding number of hexagons in the y-direction is chosen 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.
divergences: Boolean
If True divergences will be plotted in a different color, only if group is either ‘prior’ or ‘posterior’.
colorbar: bool
If True a colorbar will be included as part of the plot (Defaults to False). Only works when kind=hexbin
labellerlabeller
instance
, optional
Class providing the method make_label_vert
to generate the labels in the plot. Read the Label guide for more details and usage examples.
ax: axes, optional
Matplotlib axes or bokeh figures.
divergences_kwargs: dicts, optional
Additional keywords passed to matplotlib.axes.Axes.scatter() for divergences
scatter_kwargs:
Additional keywords passed to matplotlib.axes.Axes.scatter() when using scatter kind
kde_kwargs: dict, optional
Additional keywords passed to arviz.plot_kde() when using kde kind
hexbin_kwargs: dict, optional
Additional keywords passed to matplotlib.axes.Axes.hexbin() when using hexbin kind
backend: str, optional
Select plotting backend {“matplotlib”,”bokeh”}. Default “matplotlib”.
backend_kwargs: bool, optional
These are kwargs specific to the backend being used, passed tomatplotlib.pyplot.subplots() orbokeh.plotting.figure()
.
marginal_kwargs: dict, optional
Additional keywords passed to arviz.plot_dist(), modifying the marginal distributions plotted in the diagonal.
point_estimate: str, optional
Select point estimate from ‘mean’, ‘mode’ or ‘median’. The point estimate will be plotted using a scatter marker and vertical/horizontal lines.
point_estimate_kwargs: dict, optional
Additional keywords passed to matplotlib.axes.Axes.axvline(),matplotlib.axes.Axes.axhline() (matplotlib) orbokeh.models.Span (bokeh)
point_estimate_marker_kwargs: dict, optional
Additional keywords passed to matplotlib.axes.Axes.scatter()or bokeh:bokeh.plotting.Figure.square()
in point estimate plot. Not available in bokeh
reference_values: dict, optional
Reference values for the plotted variables. The Reference values will be plotted using a scatter marker
reference_values_kwargs: dict, optional
Additional keywords passed to matplotlib.axes.Axes.plot() orbokeh:bokeh.plotting.Figure.circle()
in reference values plot
show: bool, optional
Call backend show function.
Returns:
axes: matplotlib axes
or bokeh figures
Examples
KDE Pair Plot
import arviz as az centered = az.load_arviz_data('centered_eight') coords = {'school': ['Choate', 'Deerfield']} az.plot_pair(centered, var_names=['theta', 'mu', 'tau'], kind='kde', coords=coords, divergences=True, textsize=18)
Hexbin pair plot
az.plot_pair(centered, var_names=['theta', 'mu'], coords=coords, textsize=18, kind='hexbin')
Pair plot showing divergences and select variables with regular expressions
az.plot_pair(centered, ... var_names=['^t', 'mu'], ... filter_vars="regex", ... coords=coords, ... divergences=True, ... textsize=18)