numeraire_graphics.plot_weights_heatmap#
- numeraire_graphics.plot_weights_heatmap(weights_output: WeightsOutput | PanelWeightsOutput, *, top: int | None = None, order: str = 'mean', diverging: bool = True) plotnine.ggplot[source]#
A date x asset portfolio-weight matrix as a heatmap, signed long/short about zero.
Consumes a numeraire
WeightsOutput(wide, fixed universe) orPanelWeightsOutput(long, entering/exiting universe) object directly — the weight stream is not in the tidy result schema, so this is a family-B plotter. Each(date, asset)weight is ageom_tilewhose fill is the signed weight.A weight matrix is inherently signed, so the zero-centred diverging fill (
scale_fill_numeraire(diverging=True)) is attached by default — a long (positive) weight and a short (negative) one read as opposite hues about an unsaturated zero. Passdiverging=Falseto leave the fill scale to the caller. The rebalance-date axis is drawn as an equally-spaced ordered factor (not a continuous datetime), so tiles abut with no white gaps even when rebalances are irregularly spaced; a thinned, span-appropriate subset of dates is labelled.topkeeps only theNassets with the largest average absolute weight (the names the book actually leans on), dropping the long tail.ordersorts the asset axis:"mean"(default) orders by average weight so the persistent longs and shorts separate top-to-bottom,"name"orders alphabetically.