plot_joint_kde_and_marginals#
- agabpylib.plotting.distributions.plot_joint_kde_and_marginals(xdata, ydata, xname=None, yname=None, xunit=None, yunit=None, xlims=None, ylims=None, nx=100, ny=100, lnpmin=-5, contour_only=False, show_data=False)#
Plot the joint distribution of two variables, X and Y, for which the data set {(x_i, y_i)} is available.
The joint and marginal distributions are show in one plot, where the distributions are estimated using Kernel Density Estimation (KDE).
- Parameters:
xdata (array_like) – 1D array of values of x_i
ydata (array_like) – 1D array of values of y_i
xname (str) – Name of the X variable
yname (str) – Name of Y variable
xunit (str) – Units for the X variable.
yunit (str) – Units for the Y variable.
xlims (tuple) – Limits in x to use (min, max).
ylims (tuple) – Limits in y to use (min, max).
nx (int) – Number of KDE samples in X.
ny (int) – Number of KDE samples in Y.
lnpmin (float) – minimum value of the log of the KDE density (relative to maximum) to include in colour image.
contour_only (bool) – If true plot only the contours enclosing constant levels of cumulative probability.
show_data (bool) – If true plot the data points.
- Returns:
fig – Figure object with the plot.
- Return type:
matplotlib.figure.Figure