arviz.
plot_pair
Plot a scatter, kde and/or hexbin matrix with (optional) marginals on the diagonal.
Any object that can be converted to an az.InferenceData object Refer to documentation of az.convert_to_dataset for details
Specifies which InferenceData group should be plotted. Defaults to ‘posterior’.
Variables to be plotted, if None all variable are plotted. Prefix the variables by ~ when you want to exclude them from the plot.
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.
Coordinates of var_names to be plotted. Passed to Dataset.sel
If True pairplot will include marginal distributions for every variable
If None, size is (8 + numvars, 8 + numvars)
Text size for labels. If None it will be autoscaled based on figsize.
Type of plot to display (scatter, kde and/or hexbin)
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.
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.
If True fill the last contour of the 2D KDE plot. Defaults to True.
If True divergences will be plotted in a different color, only if group is either ‘prior’ or ‘posterior’.
If True a colorbar will be included as part of the plot (Defaults to False). Only works when kind=hexbin
Class providing the method make_label_vert to generate the labels in the plot. Read the Label guide for more details and usage examples.
Matplotlib axes or bokeh figures.
Additional keywords passed to ax.scatter for divergences
Additional keywords passed to ax.plot when using scatter kind
Additional keywords passed to az.plot_kde when using kde kind
Additional keywords passed to ax.hexbin when using hexbin kind
Select plotting backend {“matplotlib”,”bokeh”}. Default “matplotlib”.
These are kwargs specific to the backend being used. For additional documentation check the plotting method of the backend.
Additional keywords passed to az.plot_dist, modifying the marginal distributions plotted in the diagonal.
Select point estimate from ‘mean’, ‘mode’ or ‘median’. The point estimate will be plotted using a scatter marker and vertical/horizontal lines.
Additional keywords passed to ax.vline, ax.hline (matplotlib) or ax.square, Span (bokeh)
Additional keywords passed to ax.scatter in point estimate plot. Not available in bokeh
Reference values for the plotted variables. The Reference values will be plotted using a scatter marker
Additional keywords passed to ax.plot or ax.circle in reference values plot
Call backend show function.
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)