Plots¶
Figure builders¶
fundcloud.plots.cumulative
¶
cumulative(
returns: Series | DataFrame,
*,
benchmark: Series | None = None,
title: str = "Cumulative return (%)",
theme: str | None = None,
annotations: bool = False,
) -> go.Figure
Cumulative-return curve (0% at inception, percent-formatted y-axis).
returns may be a :class:pandas.Series or a :class:pandas.DataFrame
(one line per column). benchmark is drawn as a dashed reference. Each
series is dropna()'d before compounding so staggered inception dates
produce continuous lines from their own first observation rather than
broken/dashed segments.
Source code in python/fundcloud/plots/plotly.py
fundcloud.plots.drawdown
¶
drawdown(
returns: Series | DataFrame,
*,
title: str = "Drawdown (%)",
theme: str | None = None,
annotations: bool = False,
) -> go.Figure
Underwater (drawdown) chart.
Accepts a :class:pandas.Series or a multi-column
:class:pandas.DataFrame; each column is rendered as its own filled
area with reduced opacity so overlaps stay legible.
Source code in python/fundcloud/plots/plotly.py
fundcloud.plots.rolling_sharpe
¶
rolling_sharpe(
returns: Series | DataFrame,
*,
window: int = 63,
periods_per_year: int = 252,
title: str | None = None,
theme: str | None = None,
annotations: bool = False,
) -> go.Figure
Rolling annualised Sharpe (window-period window).
Multi-column input overlays one line per column.
Source code in python/fundcloud/plots/plotly.py
fundcloud.plots.return_distribution
¶
return_distribution(
returns: Series | DataFrame,
*,
bins: int = 60,
title: str = "Return distribution (%)",
theme: str | None = None,
annotations: bool = False,
) -> go.Figure
Histogram of per-period returns (in %).
Multi-column input overlays translucent histograms.
Source code in python/fundcloud/plots/plotly.py
fundcloud.plots.monthly_heatmap
¶
monthly_heatmap(
returns: Series | DataFrame,
*,
title: str = "Monthly returns (%)",
theme: str | None = None,
annotations: bool = False,
colorbar: dict[str, object] | None = None,
text_values: bool = True,
) -> go.Figure
Year × month heatmap of aggregated returns.
Requires a :class:pandas.Series or a single-column
:class:pandas.DataFrame — overlaying heatmaps is not meaningful. Pass
one column for multi-asset frames, or call :func:fundcloud.plots.summary.
text_values=True (default) renders each cell's percent-return
directly on the tile so readers don't need to colour-match against the
scale bar. Pass False on very dense panels (e.g. > 20 years) if
the numbers crowd out.
Source code in python/fundcloud/plots/plotly.py
fundcloud.plots.composition
¶
composition(
weights: DataFrame,
*,
title: str = "Portfolio composition",
theme: str | None = None,
annotations: bool = False,
) -> go.Figure
Stacked-area chart of per-asset weight over time.
Source code in python/fundcloud/plots/plotly.py
Aggregator¶
fundcloud.plots.summary
¶
summary(
returns: Series | DataFrame,
*,
benchmark: Series | str | None = None,
weights: DataFrame | None = None,
theme: str | None = None,
title: str | None = None,
heatmap_asset: str | None = None,
) -> go.Figure
Return a composite figure with the canonical tearsheet panels.
Each section uses a full-width row — easier to read than a tiled grid:
== =============================================================
row content
== =============================================================
1 Cumulative returns
2 Drawdown (%)
3 Rolling Sharpe
4 Return distribution (%)
5 Monthly returns heatmap (first series)
6 Portfolio composition (only when weights is supplied)
== =============================================================
Annotations (annotations=True) are applied per panel — stats pills,
VaR/CVaR reference lines, full-period Sharpe reference, heatmap cell
values. A single color per asset is maintained across rows, and each
asset contributes one legend entry rather than one per panel.
Source code in python/fundcloud/plots/aggregated.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
Theming¶
fundcloud.plots.set_theme
¶
Select the plotly template used by subsequent fundcloud figures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
A fundcloud alias ( |
required |
Source code in python/fundcloud/plots/themes.py
fundcloud.plots.get_theme
¶
Matplotlib mirrors¶
fundcloud.plots.mpl
¶
Matplotlib-backed mirrors of the plotly builders.
Each figure-level public builder has a private _build_<name>(ax, ...)
companion that draws into a supplied :class:~matplotlib.axes.Axes. This
split lets :func:summary compose panels via
:class:~matplotlib.gridspec.GridSpec without spinning up and harvesting
independent :class:matplotlib.figure.Figure objects.
Theming is intentionally a plotly-only concern (see
:mod:fundcloud.plots.themes). The matplotlib builders keep their
static styling.
Requires fundcloud[viz] for matplotlib.
cumulative
¶
cumulative(
returns: Series | DataFrame,
*,
benchmark: Series | None = None,
title: str = "Cumulative return (%)",
annotations: bool = False,
) -> Any
Source code in python/fundcloud/plots/mpl.py
drawdown
¶
drawdown(
returns: Series | DataFrame,
*,
title: str = "Drawdown (%)",
annotations: bool = False,
) -> Any
Source code in python/fundcloud/plots/mpl.py
rolling_sharpe
¶
rolling_sharpe(
returns: Series | DataFrame,
*,
window: int = 63,
periods_per_year: int = 252,
title: str | None = None,
annotations: bool = False,
) -> Any
Source code in python/fundcloud/plots/mpl.py
return_distribution
¶
return_distribution(
returns: Series | DataFrame,
*,
bins: int = 60,
title: str = "Return distribution (%)",
annotations: bool = False,
) -> Any
Source code in python/fundcloud/plots/mpl.py
monthly_heatmap
¶
monthly_heatmap(
returns: Series | DataFrame,
*,
title: str = "Monthly returns (%)",
annotations: bool = False,
) -> Any
Source code in python/fundcloud/plots/mpl.py
composition
¶
composition(
weights: DataFrame,
*,
title: str = "Portfolio composition",
annotations: bool = False,
) -> Any
Source code in python/fundcloud/plots/mpl.py
summary
¶
summary(
returns: Series | DataFrame,
*,
benchmark: Series | None = None,
weights: DataFrame | None = None,
title: str | None = None,
) -> Any
Matplotlib counterpart of :func:fundcloud.plots.summary.
Returns a single :class:matplotlib.figure.Figure composing the same
canonical panels via :class:~matplotlib.gridspec.GridSpec.