csep.plots.plot_cumulative_events_versus_time

csep.plots.plot_cumulative_events_versus_time(catalog_forecast, observation, time_axis='datetime', bins=50, sim_label='Simulated', obs_label='Observation', ax=None, show=False, **kwargs)[source]

Plots the cumulative number of forecasted events from a CatalogForecast versus the observed events over time.

Parameters:
  • catalog_forecast (CatalogForecast) – The forecasted synthetic catalogs.

  • observation (CSEPCatalog) – The observed catalog.

  • time_axis (str, optional) – The type of time axis (‘datetime’, ‘days’, ‘hours’). Defaults to ‘datetime’.

  • bins (int, optional) – The number of bins for time slicing. Defaults to 50.

  • sim_label (str, optional) – Label for simulated data. Defaults to ‘Simulated’.

  • obs_label (str, optional) – Label for observed data. Defaults to ‘Observation’.

  • ax (matplotlib.axes.Axes, optional) – Axis object on which to plot. If not provided, a new figure and axis are created. Defaults to None.

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

  • **kwargs (optional) –

    Additional keyword arguments to customize the plot:

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

    • xlabel (str): Label for the X-axis. Defaults to ‘Datetime’, ‘Days after Mainshock’, or ‘Hours after Mainshock’, depending on time_axis.

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

    • ylabel (str): Label for the Y-axis. Defaults to ‘Cumulative event counts’.

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

    • title (str): Title of the plot. Defaults to None.

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

    • color (str): Color for the simulated forecast.

    • linewidth (float): Line width for the plot lines. Defaults to 1.5.

    • grid (bool): Whether to show grid lines. Defaults to True.

    • legend (bool): Whether to show the legend. Defaults to True.

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

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

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

    • datetime_locator (matplotlib.dates.Locator): Locator for the X-axis datetime ticks.

    • datetime_formatter (str or matplotlib.dates.Formatter): Formatter for the datetime axis. Defaults to '%Y-%m-%d'.

Returns:

The Matplotlib axes object with the plotted data.

Return type:

matplotlib.axes.Axes

Changed in version 0.8.0: It now requires a CatalogForecast rather than a list of stochastic event sets. The plot_args dictionary is only partially supported and will be removed in v1.0.0

Added in version 0.8.0: Added time_axis parameter to show x-axis as daytimes or time-unit after first event. Added parameters to customize coloring, formatting and sizing of the plot elements.