arviz.plot_joint

arviz.plot_joint(data, var_names=None, coords=None, figsize=None, textsize=None, kind='scatter', gridsize='auto', contour=True, fill_last=True, joint_kwargs=None, marginal_kwargs=None)[source]

Plot a scatter or hexbin of two variables with their respective marginals distributions.

Parameters:
data : obj

Any object that can be converted to an az.InferenceData object Refer to documentation of az.convert_to_dataset for details

var_names : Iter of 2 e.g. (var_1, var_2)

Variables to be plotted, two variables are required.

coords : mapping, optional

Coordinates of var_names to be plotted. Passed to 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.

kind : str

Type of plot to display (scatter, kde or hexbin)

gridsize : int or (int, int), optional.

The number of hexagons in the x-direction. Ignored when hexbin is False. See plt.hexbin for details

contour : bool

If True plot the 2D KDE using contours, otherwise plot a smooth 2D KDE. Defaults to True.

fill_last : bool

If True fill the last contour of the 2D KDE plot. Defaults to True.

joint_kwargs : dicts, optional

Additional keywords modifying the join distribution (central subplot)

marginal_kwargs : dicts, optional

Additional keywords modifying the marginals distributions (top and right subplot)

Returns:
axjoin : matplotlib axes, join (central) distribution
ax_hist_x : matplotlib axes, x (top) distribution
ax_hist_y : matplotlib axes, y (right) distribution

Examples

Scatter Joint plot

>>> import arviz as az
>>> data = az.load_arviz_data('non_centered_eight')
>>> az.plot_joint(data,
>>>             var_names=['theta'],
>>>             coords={'school': ['Choate', 'Phillips Andover']},
>>>             kind='scatter',
>>>             figsize=(6, 6))
../_images/arviz-plot_joint-1.png

Hexbin Joint plot

>>> az.plot_joint(data,
>>>             var_names=['theta'],
>>>             coords={'school': ['Choate', 'Phillips Andover']},
>>>             kind='hexbin',
>>>             figsize=(6, 6))
../_images/arviz-plot_joint-2.png

KDE Joint plot

>>> az.plot_joint(data,
>>>                 var_names=['theta'],
>>>                 coords={'school': ['Choate', 'Phillips Andover']},
>>>                 kind='kde',
>>>                 figsize=(6, 6))
../_images/arviz-plot_joint-3.png