plot_credal_set

probly.plot.credal.plot.plot_credal_set(data: ArrayCategoricalCredalSet | TorchCategoricalCredalSet, *, title: str | None = None, labels: list[str] | None = None, series_labels: list[str] | None = None, config: PlotConfig | None = None, show: bool = False, gridlines: bool = True, ground_truth: SingletonCredalSet | None = None) Axes[source]

Plot a Categorical credal set.

For 2-class credal sets, renders a horizontal interval plot where the x-axis represents P(class 2). For 3-class credal sets, renders a ternary simplex diagram. For 4+ classes, renders a spider (radar) plot.

Dispatches to a type-specific renderer based on the concrete credal set type. For batched inputs, each element in the batch is overlaid on the same axes with a distinct color.

The following types are supported:

  • ProbabilityIntervalsCredalSet: drawn as a filled interval (2-class), feasibility envelope (3-class), or constant-width bars on spokes (4+ classes).

  • DistanceBasedCredalSet: drawn as a filled interval/envelope/bars with the nominal distribution marked as a point.

  • ConvexCredalSet / DiscreteCredalSet: drawn as an interval with vertex markers (2-class), convex hull envelope (3-class), or min/max envelope (4+ classes).

  • SingletonCredalSet: drawn as a single scatter marker or closed envelope on spokes.

Parameters:
  • data – The credal set to plot.

  • title – Title of the plot.

  • labels – Class labels. Defaults to ["C0", "C1", ...].

  • series_labels – Optional legend labels, one per batch element. When provided a legend is shown. Defaults to None (no legend).

  • config – Plot configuration. Defaults to PlotConfig().

  • show – Whether to call plt.show() after plotting.

  • gridlines – Whether to display gridlines. Used for 3-class (ternary) and 4+-class (spider) plots. Defaults to True.

  • ground_truth – Optional ground-truth distribution to overlay as a star marker. Must be an SingletonCredalSet with the same number of classes as data.

Returns:

The matplotlib axes with the plot.

Raises: