safeai.rge.plot_rge

safeai.rge.plot_rge(result, *, model_name='Model', x_key=None, x_label=None, x_scale=1.0, y_key='rge_rescaled', title=None, fig_size=(12, 6), save_path=None, show=False)[source]

Plot one RGE curve or a comparison of several RGE curves.

Parameters:
  • result (dict) – Either one result returned by rge_curve(…) or the full dictionary returned by compare_rge(…).

  • model_name (str, default='Model') – Label used when result is a single curve.

  • x_key (str, optional) – Name of the x-axis field in each result. If None, it is inferred from the result keys.

  • x_label (str, optional) – Human-readable x-axis label. If None, a default label is selected.

  • x_scale (float, default=1.0) – Multiplier applied to x values before plotting. Use 100 for percentage axes when the stored values are fractions.

  • y_key (str, default='rge_rescaled') – Name of the y-axis field to plot.

  • title (str, optional) – Plot title. If None, a default title is selected.

  • fig_size (tuple, default=(12, 6)) – Matplotlib figure size.

  • save_path (str or None, default=None) – If provided, save the plot to this path.

  • show (bool, default=False) – If True, display the plot with plt.show().

Returns:

If save_path is provided and show is False, returns save_path. Otherwise, returns (fig, ax).

Return type:

str or tuple