Gallery#
Every figure, grouped by the input family it consumes. Each is a pure function returning a ggplot;
compose it with theme_numeraire() and a colour scale, then render or save.
Family A — result-schema plotters#
These read the tidy result table every evaluator emits — one row per method × date × metric.
Per-date rows (e.g. StrategyReturnEvaluator’s strategy_return) feed the time-series plots;
summary rows (e.g. sharpe) feed the bar and curve plots.
Geometric wealth curve with a drawdown facet, an optional benchmark line and recession shading.
plot_cumulative(results, benchmark=None, recessions=None)
Trailing-window rolling Sharpe, mean, or volatility — one line per method.
plot_rolling(results, window=36, metric="sharpe")
A summary metric as bars across a grouping column, with confidence-interval whiskers when derivable.
plot_metric_by(results, metric="sharpe", x="method")
A metric plotted against a caller-supplied complexity axis (shrinkage intensity, parameter count).
plot_complexity_curve(results, x="n_params", metric="oos_r2", ribbon=None)
Information-coefficient decay by horizon, from ICEvaluator rows joined to a numeric horizon.
plot_ic_decay(results, horizon="horizon", metric="ic", smooth=False)
Family B — Output / frame plotters#
These need inputs the tidy schema does not carry, so they take a numeraire Output object or a caller-supplied frame directly.
A date × asset weight matrix as geom_tile, signed long/short, from a
WeightsOutput object.
plot_weights_heatmap(weights_output, top=None, order="mean")
Loading paths over an axis, or a loadings heatmap, from a caller-supplied tidy loadings frame.
plot_factor_loadings(loadings, x="date")
A risk–return efficient frontier, optionally overlaying named portfolios, from a risk/return
frame.
plot_frontier(frontier, points=None)
Helpers#
The publication house theme (serif, flat strips, y-only grid) — compose it onto any figure.
fig + theme_numeraire(base_size=8)
Colourblind-safe Okabe–Ito discrete scales; the fill scale also offers a zero-centred diverging mode for the signed weights heatmap.
fig + scale_color_numeraire()
fig + scale_fill_numeraire(diverging=True)
The sole save surface — sizes the figure exactly in centimetres under a print font profile.
save_paper(fig, "figure.pdf", width_cm=8, height_cm=6)
A small numpy-only convenience that traces a risk/return frame from a mean vector and covariance
for plot_frontier.
frontier = mean_variance_frontier(mean, cov, n=50)