uadapy.plotting.plots_nd module
- uadapy.plotting.plots_nd.maximize_axes_limits(axs, plot_mask=None)
- uadapy.plotting.plots_nd.plot_contour(distributions, n_samples_kde=1000, resolution=128, ranges=None, quantiles: list = None, seed=55, fig=None, axs=None, distrib_colors=None, colorblind_safe=False, show_plot=False, plot_mask=None)
Visualizes a multidimensional distribution in a matrix of contour plots. For this, the 2D/1D marginal distributions have to be estimated for each combination of dimensions. This is done via KDE on samples drawn from the distribution.
- Parameters:
distributions (list) – List of distributions to plot.
n_samples_kde (int) – Number of samples drawn per distribution to estimate the marginal 2D distributions via KDE. Default 1000.
resolution (int, optional) – The resolution for the pdf. Default is 128.
ranges (list or None, optional) – Array of ranges for all dimensions. If None, the ranges are calculated based on the distributions.
quantiles (list or None, optional) – List of quantiles to use for determining isovalues. If None, the 95%, 75%, and 25% quantiles are used.
seed (int) – Seed for the random number generator for reproducibility. It defaults to 55 if not provided.
fig (matplotlib.figure.Figure or None, optional) – Figure object to use for plotting. If None, a new figure will be created.
axs (Array of matplotlib.axes.Axes or None, optional) – Axes objects to use for plotting. If None, new axes will be created.
distrib_colors (list or None, optional) – List of colors to use for each distribution. If None, Matplotlib Set2 and glasbey colors will be used.
colorblind_safe (bool, optional) – If True, the plot will use colors suitable for colorblind individuals. Default is False.
show_plot (bool, optional) – If True, display the plot. Default is False.
plot_mask (2D boolean array or function (i,j)->bool, optional) – mask that specifies which subplots will be generated. By default every plot will be generated.
- Returns:
matplotlib.figure.Figure – The figure object containing the plot.
list – List of Axes objects used for plotting.
- Raises:
ValueError – If a quantile is not between 0 and 100 (exclusive), or if a quantile results in an index that is out of bounds.
Exception – If the dimension of the distribution is less than 2.
- uadapy.plotting.plots_nd.plot_contour_samples(distributions, n_samples=100, n_samples_kde=1000, resolution=128, point_size=1, alpha=1, ranges=None, quantiles: list = None, seed=55, fig=None, axs=None, distrib_colors=None, colorblind_safe=False, show_plot=False)
Visualizes a multidimensional distribution in a matrix visualization where the upper triangle contains contour plots and the lower triangle contains scatterplots.
- Parameters:
distributions (list) – List of distributions to plot.
n_samples (int) – Number of samples for the scatterplots.
n_samples_kde (int) – Number of samples drawn per distribution to estimate the marginal 2D distributions via KDE. Default 1000.
resolution (int, optional) – The resolution for the pdf. Default is 128.
point_size (float or None, optional) – Marker size (area in points^2). If None, matplotlib’s default is used. By default 1.
alpha (float, optional) – opacity value if the samples in the scatter plots. By default 1 (fully opaque)
ranges (list or None, optional) – Array of ranges for all dimensions. If None, the ranges are calculated based on the distributions.
quantiles (list or None, optional) – List of quantiles to use for determining isovalues. If None, the 95%, 75%, and 25% quantiles are used.
seed (int) – Seed for the random number generator for reproducibility. It defaults to 55 if not provided.
fig (matplotlib.figure.Figure or None, optional) – Figure object to use for plotting. If None, a new figure will be created.
axs (Array of matplotlib.axes.Axes or None, optional) – Axes objects to use for plotting. If None, new axes will be created.
distrib_colors (list or None, optional) – List of colors to use for each distribution. If None, Matplotlib Set2 and glasbey colors will be used.
colorblind_safe (bool, optional) – If True, the plot will use colors suitable for colorblind individuals. Default is False.
show_plot (bool, optional) – If True, display the plot. Default is False.
- Returns:
matplotlib.figure.Figure – The figure object containing the plot.
list – List of Axes objects used for plotting.
- Raises:
ValueError – If a quantile is not between 0 and 100 (exclusive), or if a quantile results in an index that is out of bounds.
Exception – If the dimension of the distribution is less than 2.
Sets up the axis sharing for a plot matrix. I.e. all axes in the same column share X, and all axes in the same row (except for the diagonal) share Y.
- uadapy.plotting.plots_nd.plot_samples(distributions, n_samples=100, seed=55, point_size=1, alpha=1, fig=None, axs=None, distrib_colors=None, colorblind_safe=False, show_plot=False, plot_mask=None)
Plot samples from the multivariate distribution as a SPLOM.
- Parameters:
distributions (list) – List of distributions to plot.
n_samples (int) – Number of samples per distribution.
seed (int) – Seed for the random number generator for reproducibility. It defaults to 55 if not provided.
point_size (float or None, optional) – Marker size (area in points^2). If None, matplotlib’s default is used. By default 1.
alpha (float, optional) – opacity value if the samples in the scatter plots. By default 1 (fully opaque)
fig (matplotlib.figure.Figure or None, optional) – Figure object to use for plotting. If None, a new figure will be created.
axs (Array of matplotlib.axes.Axes or None, optional) – Axes objects to use for plotting. If None, new axes will be created.
distrib_colors (list or None, optional) – List of colors to use for each distribution. If None, Matplotlib Set2 and glasbey colors will be used.
colorblind_safe (bool, optional) – If True, the plot will use colors suitable for colorblind individuals. Default is False.
show_plot (bool, optional) – If True, display the plot. Default is False.
plot_mask (2D boolean array or function (i,j)->bool, optional) – mask that specifies which subplots will be generated. By default every plot will be generated.
- Returns:
matplotlib.figure.Figure – The figure object containing the plot.
list – List of Axes objects used for plotting.