uadapy.plotting package
Submodules
uadapy.plotting.distribution_plot module
- class uadapy.plotting.distribution_plot.InteractiveNormal(mean: ndarray, cov: ndarray, ax: Axes, n_std: float = 1.0, extends: float = 10, epsilon: float = 10, x_label: str = '', y_label: str = '')
Bases:
object
- get_ind_under_point(event)
get the index of the vertex under point if within epsilon tolerance
- init_points()
- update(plot_int: bool = False)
- uadapy.plotting.distribution_plot.confidence_ellipse(mean: ndarray, cov: ndarray, ax: Axes, n_std: float = 3.0, facecolor='blue', **kwargs)
Create a plot of the covariance confidence ellipse of x and y.
- Parameters:
ax (matplotlib.axes.Axes) – The axes object to draw the ellipse into.
n_std (float) – The number of standard deviations to determine the ellipse’s radiuses.
**kwargs – Forwarded to ~matplotlib.patches.Ellipse
- Return type:
matplotlib.patches.Ellipse
uadapy.plotting.interactive_splom module
uadapy.plotting.plots2D module
- uadapy.plotting.plots2D.plot_contour(distributions, resolution=128, ranges=None, quantiles: list | None = None, seed=55, distrib_colors=None, colorblind_safe=False, show_plot=False)
Plot contour plots for samples drawn from given distributions.
- Parameters:
distributions (list) – List of distributions to plot.
resolution (int, optional) – The resolution of the plot. Default is 128.
ranges (list or None, optional) – The ranges for the x and y axes. 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.
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.
- uadapy.plotting.plots2D.plot_contour_bands(distributions, n_samples, resolution=128, ranges=None, quantiles: list | None = None, seed=55, show_plot=False)
Plot contour bands for samples drawn from given distributions.
- Parameters:
distributions (list) – List of distributions to plot.
n_samples (int) – Number of samples per distribution.
resolution (int, optional) – The resolution of the plot. Default is 128.
ranges (list or None, optional) – The ranges for the x and y axes. 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.
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.
- uadapy.plotting.plots2D.plot_samples(distributions, n_samples, seed=55, xlabel=None, ylabel=None, title=None, distrib_colors=None, colorblind_safe=False, show_plot=False)
Plot samples from the given distribution. If several distributions should be plotted together, an array can be passed to this function.
- 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.
xlabel (string, optional) – label for x-axis.
ylabel (string, optional) – label for y-axis.
title (string, optional) – title for the plot.
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.
uadapy.plotting.plotsND module
- uadapy.plotting.plotsND.plot_contour(distributions, n_samples, resolution=128, ranges=None, quantiles: list | None = None, seed=55, distrib_colors=None, colorblind_safe=False, show_plot=False)
Visualizes a multidimensional distribution in a matrix of contour plots.
- Parameters:
distributions (list) – List of distributions to plot.
n_samples (int) – Number of samples per distribution.
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.
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.
- uadapy.plotting.plotsND.plot_contour_samples(distributions, n_samples, resolution=128, ranges=None, quantiles: list | None = None, seed=55, distrib_colors=None, colorblind_safe=False, show_plot=False)
Visualizes a multidimensional distribution in a matrix visualization where the upper diagonal contains contour plots and the lower diagonal contains scatterplots.
- Parameters:
distributions (list) – List of distributions to plot.
n_samples (int) – Number of samples for the scatterplot.
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.
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.
- uadapy.plotting.plotsND.plot_samples(distributions, n_samples, seed=55, distrib_colors=None, colorblind_safe=False, show_plot=False)
Plot samples from the multivariate distribution as a SLOM.
- 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.
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.
uadapy.plotting.utils module
- uadapy.plotting.utils.create_shaded_set2_colormap(alpha_values)
Create a custom colormap by varying alpha values for each Set2 color.
Parameters: - alpha_values: list or array of alpha values to apply to each Set2 color (e.g., [0.3, 0.6, 1]).
Returns: - A custom colormap with 8 Set2 colors, each with 3 alpha variations (total of 24 colors).
- uadapy.plotting.utils.generate_random_colors(n)
- uadapy.plotting.utils.generate_spectrum_colors(n)
- uadapy.plotting.utils.get_colors(n)