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
dataobj

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

var_namesIter of 2 e.g. (var_1, var_2)

Variables to be plotted, two variables are required.

coordsmapping, optional

Coordinates of var_names to be plotted. Passed to Dataset.sel

figsizetuple

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.

kindstr

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

gridsizeint or (int, int), optional.

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

contourbool

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

fill_lastbool

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

joint_kwargsdicts, optional

Additional keywords modifying the join distribution (central subplot)

marginal_kwargsdicts, optional

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

Returns
axjoinmatplotlib axes, join (central) distribution
ax_hist_xmatplotlib axes, x (top) distribution
ax_hist_ymatplotlib 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