Plotting¶
Plotting functions. Each returns the matplotlib Axes it drew on.
- omnicast.plot_metric_by_horizon(metrics_df, metric_col, title='Metric by Forecast Horizon', ylabel=None, colors=None, horizons=None, target_val=None, is_percentage=False, figsize=(10, 5), ax=None, save_path=None)[source]¶
Plot a metric across forecast horizons, one line per model.
- Parameters:
metrics_df (
DataFrame) – Long-format table with columnsmodel,horizon, andmetric_col.metric_col (
str) – Metric column to plot on the y-axis.title (
str) – Title and y-axis label (ylabeldefaults tometric_col).ylabel (
str|None) – Title and y-axis label (ylabeldefaults tometric_col).colors (
dict[str,str] |None) – Mapping of model name to line colour.horizons (
list[int] |None) – x-axis ticks. Defaults to the sorted unique horizons in the data.target_val (
float|None) – Reference value drawn as a horizontal dashed line.is_percentage (
bool) – Multiply values andtarget_valby 100 before plotting.figsize (
tuple[float,float]) – Figure size when a new figure is created.ax (
Axes|None) – Axes to draw on. A new figure is created when omitted.save_path (
str|None) – If given, save the figure here at 300 dpi.
- Return type:
Axes
- omnicast.plot_backtest(result, observed=None, title='Backtest Out-of-Sample Predictions', show_intervals=True, figsize=(10, 5), ax=None, save_path=None)[source]¶
Plot rolling-origin backtest predictions against observations.
- Parameters:
result (
BacktestResult|DataFrame) – ABacktestResult(its.predictionsare used) or the predictions table directly: columnscutoff,target_date,predicted, and optionallower_*/upper_*.observed (
Series|None) – History to draw the predictions against. Defaults toresult.observed(aBacktestResultalways carries it), then to theactualcolumn of the predictions.title (
str)show_intervals (
bool) – Draw the per-fold interval band when interval columns are present.ax (
Axes|None)
- Return type:
Axes