probly.visualization.dirichlet.plot_dirichlet
Plotting Dirichlet distributions on a ternary simplex.
Classes
-
class probly.visualization.dirichlet.plot_dirichlet.DirichletTernaryVisualizer[source]
Bases: object
Class to collect ternary Dirichlet plots.
-
class Dirichlet(alpha)[source]
Bases: object
Dirichlet distribution.
- Parameters:
alpha (np.ndarray)
-
pdf(x)[source]
Compute the Dirichlet pdf.
- Parameters:
x (ndarray) – Barycentric coordinates.
- Returns:
The PDF value at x as a float.
- Return type:
float
-
dirichlet_plot(alpha, labels, title, ax=None, subdiv=7, nlevels=200, **contour_kwargs)[source]
Plot Dirichlet pdf contours on a ternary simplex.
- Parameters:
alpha (np.ndarray) – Dirichlet concentration parameters.
labels (list[str]) – Labels of the ternary corners.
title (str) – Title of the plot.
ax (Axes | None) – Matplotlib axes.Axes to plot on.
subdiv (int) – Triangular mesh subdivision depth.
nlevels (int) – Number of contour levels.
cmap – Matplotlib colormap.
contour_kwargs (Any)
- Returns:
Ternary plot with Dirichlet contours.
- Return type:
Axes
-
label_corners_and_vertices(ax, labels)[source]
Label corners, vertices, and edge ticks.
- Parameters:
-
- Return type:
None
-
triangle_corners()[source]
Return the corners of the equilateral ternary triangle.
- Return type:
ndarray
-
xy_to_barycentric(xy, tol=0.0001)[source]
Convert Cartesian coordinates to barycentric coordinates.
- Parameters:
-
- Returns:
Barycentric coordinates.
- Return type:
ndarray