csep.plots.plot_consistency_test

csep.plots.plot_consistency_test(eval_results, normalize=False, one_sided_lower=False, percentile=95, plot_mean=False, color='black', ax=None, show=False, **kwargs)[source]

Plots the results from one or multiple consistency tests. The distribution of score results from multiple realizations of a model are plotted as a line representing a given percentile. The score of the observation under a model is plotted as a marker. The model is assumed inconsistent when the observation score lies outside the model distribution for a two-sided test, or lies to the right of the distribution for a one-sided test.

Parameters:
  • eval_results (list of EvaluationResult or EvaluationResult) – Evaluation results from one or multiple models.

  • normalize (bool, optional) – Normalize the forecast likelihood by observed likelihood. Defaults to False.

  • one_sided_lower (bool, optional) – Plot for a one-sided test. Defaults to False.

  • percentile (float, optional) – Percentile for the extent of the model score distribution. Defaults to 95.

  • ax (matplotlib.axes.Axes, optional) – Axes object to plot on. If None, creates a new figure. Defaults to None.

  • plot_mean (bool, optional) – Plot the mean of the test distribution. Defaults to False.

  • color (str, optional) – Color for the line representing a model score distribution. Defaults to ‘black’.

  • show (bool, optional) – If True, displays the plot. Defaults to False.

  • **kwargs (optional) –

    Additional keyword arguments for plot customization:

    • figsize (tuple): The size of the figure.

    • capsize (float): Size of the caps on the error bars.

    • linewidth (float): Width of the error bars and lines.

    • xlabel (str): Label for the X-axis.

    • xlabel_fontsize (int): Font size for the X-axis label.

    • ylabel_fontsize (int): Font size for the Y-axis labels.

    • xticks_fontsize (int): Font size for the X-axis ticks.

    • title (str): Title of the plot.

    • title_fontsize (int): Font size of the plot title.

    • hbars (bool): Whether to include horizontal bars for visual separation.

    • legend (bool): Whether to display a legend. Defaults to True.

    • legend_loc (‘int’, str): Location of the legend. Defaults to ‘best’.

    • legend_fontsize (int): Font size for the legend text.

    • legend_labelspacing (float): Vertical spacing between legend elements.

    • legend_borderpad (float): Padding between legend frame and elements.

    • legend_framealpha (float): Transparency value for the legend frame.

    • tight_layout (bool): Whether to use tight layout for the figure. Defaults to True.

Returns:

Matplotlib axes object with the consistency test plot.

Return type:

matplotlib.axes.Axes

Changed in version 0.8.0: plot_args dictionary is only partially supported and will be removed in v1.0.0.

Added in version 0.8.0: Added option to plot mean statistic. Added legend option to automatically create legend.